use of org.apache.cxf.ws.addressing.WSAddressingFeature in project steve by RWTH-i5-IDSG.
the class ClientProvider method getBean.
public static JaxWsProxyFactoryBean getBean(String endpointAddress) {
JaxWsProxyFactoryBean f = new JaxWsProxyFactoryBean();
f.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
f.getFeatures().add(LoggingFeatureProxy.INSTANCE.get());
f.getFeatures().add(new WSAddressingFeature());
f.setAddress(endpointAddress);
return f;
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project steve by RWTH-i5-IDSG.
the class ApplicationTest method getBean.
private static JaxWsProxyFactoryBean getBean(String endpointAddress) {
JaxWsProxyFactoryBean f = new JaxWsProxyFactoryBean();
f.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
f.getFeatures().add(new WSAddressingFeature());
f.setAddress(endpointAddress);
return f;
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class SoapBindingFactory method setupUDP.
protected void setupUDP(InterceptorProvider p, EndpointInfo ei) {
// soap UDP requires ws-addressing turned on
WSAddressingFeature add = new WSAddressingFeature();
add.setAddressingRequired(true);
add.initialize(p, bus);
// UDP has a strict size limit on messages (<64K) so we'll try to shrink the
// message a little by putting the WSA namespace into the
// the soap:env which allows it to not be written on every header
// element as well as disable the output stream optimizations (doesn't really
// matter on such small messages anyway) to make sure we pickup those
// namespaces that are declared there.
p.getOutInterceptors().add(new AbstractSoapInterceptor(Phase.POST_LOGICAL) {
public void handleMessage(SoapMessage message) throws Fault {
AddressingProperties p = ContextUtils.retrieveMAPs(message, false, true);
if (p == null) {
return;
}
String ns = p.getNamespaceURI();
Map<String, String> nsMap = message.getEnvelopeNs();
if (nsMap == null) {
nsMap = new HashMap<>();
} else {
nsMap = new HashMap<>(nsMap);
}
message.put("soap.env.ns.map", nsMap);
if (!nsMap.containsValue(ns) && !nsMap.containsKey("wsa")) {
nsMap.put("wsa", ns);
}
message.put(AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION, Boolean.TRUE);
}
});
// don't send the optional ReplyTo headers if we don't need to either
ei.setProperty("ws-addressing.write.optional.replyto", Boolean.FALSE);
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class ClientServerTest method testEchoProviderAsyncDecoupledEndpoints.
@Test
public void testEchoProviderAsyncDecoupledEndpoints() throws Exception {
String requestString = "<echo/>";
Service service = Service.create(serviceName);
service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName, StreamSource.class, Service.Mode.PAYLOAD, new LoggingFeature());
Client client = ((DispatchImpl<StreamSource>) dispatcher).getClient();
WSAddressingFeature wsAddressingFeature = new WSAddressingFeature();
wsAddressingFeature.initialize(client, client.getBus());
dispatcher.getRequestContext().put("org.apache.cxf.ws.addressing.replyto", "http://localhost:" + CLIENT_PORT + "/SoapContext/AsyncEchoClient");
StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
StreamSource response = dispatcher.invoke(request);
assertEquals(requestString, StaxUtils.toString(response));
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class LifeCycleTest method testGetActiveFeatures.
@Test
public void testGetActiveFeatures() {
assertNotNull("unexpected non-null ServerLifeCycleManager", manager);
manager.registerListener(new ServerLifeCycleListener() {
public void startServer(Server server) {
org.apache.cxf.endpoint.Endpoint endpoint = server.getEndpoint();
updateMap(startNotificationMap, endpoint.getEndpointInfo().getAddress());
String portName = endpoint.getEndpointInfo().getName().getLocalPart();
if ("SoapPort".equals(portName)) {
List<Feature> active = endpoint.getActiveFeatures();
assertNotNull(active);
assertEquals(1, active.size());
assertTrue(active.get(0) instanceof WSAddressingFeature);
assertSame(active.get(0), AbstractFeature.getActive(active, WSAddressingFeature.class));
} else {
List<Feature> active = endpoint.getActiveFeatures();
assertNotNull(active);
assertEquals(0, active.size());
assertNull(AbstractFeature.getActive(active, WSAddressingFeature.class));
}
}
public void stopServer(Server server) {
updateMap(stopNotificationMap, server.getEndpoint().getEndpointInfo().getAddress());
}
});
Endpoint greeter = Endpoint.publish(ADDRESSES[0], new GreeterImpl());
Endpoint control = Endpoint.publish(ADDRESSES[1], new ControlImpl());
greeter.stop();
control.stop();
for (int i = 0; i < 2; i++) {
verifyNotification(startNotificationMap, ADDRESSES[i], 1);
verifyNotification(stopNotificationMap, ADDRESSES[i], 1);
}
}
Aggregations