Search in sources :

Example 1 with WSAddressingFeature

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;
}
Also used : WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 2 with WSAddressingFeature

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;
}
Also used : WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 3 with WSAddressingFeature

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);
}
Also used : AbstractSoapInterceptor(org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor) WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) HashMap(java.util.HashMap) Fault(org.apache.cxf.interceptor.Fault) SoapFault(org.apache.cxf.binding.soap.wsdl.extensions.SoapFault) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with WSAddressingFeature

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));
}
Also used : WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) ByteArrayInputStream(java.io.ByteArrayInputStream) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) StreamSource(javax.xml.transform.stream.StreamSource) LoggingFeature(org.apache.cxf.ext.logging.LoggingFeature) SOAPService(org.apache.hello_world_soap_http.SOAPService) Service(javax.xml.ws.Service) ExecutorService(java.util.concurrent.ExecutorService) Client(org.apache.cxf.endpoint.Client) SOAPServiceMultiPortTypeTest(org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest) SOAPServiceBogusAddressTest(org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest) Test(org.junit.Test)

Example 5 with WSAddressingFeature

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);
    }
}
Also used : WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) Server(org.apache.cxf.endpoint.Server) Endpoint(javax.xml.ws.Endpoint) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) List(java.util.List) ControlImpl(org.apache.cxf.greeter_control.ControlImpl) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Aggregations

WSAddressingFeature (org.apache.cxf.ws.addressing.WSAddressingFeature)21 Test (org.junit.Test)8 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)4 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 QName (javax.xml.namespace.QName)2 BusException (org.apache.cxf.BusException)2 Client (org.apache.cxf.endpoint.Client)2 Endpoint (org.apache.cxf.endpoint.Endpoint)2 Server (org.apache.cxf.endpoint.Server)2 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)2 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)2 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)2 AbstractCXFTest (org.apache.cxf.test.AbstractCXFTest)2 Conduit (org.apache.cxf.transport.Conduit)2 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)2 GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1