// HTTP Component
HttpComponent component = new HttpComponent();
container.activateComponent(component, "HTTPComponent");
// Add a receiver component
ActivationSpec asEcho = new ActivationSpec("echo", new EchoComponent() {
public Document getServiceDescription(ServiceEndpoint endpoint) {
try {
Definition def = WSDLFactory.newInstance().newDefinition();
PortType type = def.createPortType();
type.setUndefined(false);
type.setQName(new QName("http://test", "MyConsumerInterface"));
Binding binding = def.createBinding();
binding.setQName(new QName("http://test", "MyConsumerBinding"));
binding.setUndefined(false);
binding.setPortType(type);
Service svc = def.createService();
svc.setQName(new QName("http://test", "MyConsumerService"));
Port port = def.createPort();
port.setBinding(binding);
port.setName("myConsumer");
svc.addPort(port);
def.setTargetNamespace("http://test");
def.addNamespace("tns", "http://test");
def.addPortType(type);
def.addBinding(binding);
def.addService(svc);
Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
return doc;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
asEcho.setEndpoint("myConsumer");
asEcho.setService(new QName("http://test", "MyConsumerService"));
container.activateComponent(asEcho);
// Start container
container.start();