Search in sources :

Example 56 with AddressingFeature

use of javax.xml.ws.soap.AddressingFeature in project cxf by apache.

the class JaxWsEndpointImpl method resolveFeatures.

public final void resolveFeatures() {
    AddressingFeature addressing = getAddressingFeature();
    if (addressing == null) {
        return;
    }
    if (addressing.isEnabled()) {
        WSAddressingFeature feature = getWSAddressingFeature();
        if (feature == null) {
            feature = new WSAddressingFeature();
            addAddressingFeature(feature);
        }
        feature.setAddressingRequired(addressing.isRequired());
        feature.setResponses(addressing.getResponses().toString());
    } else {
        removeAddressingFeature();
        getEndpointInfo().setProperty("org.apache.cxf.ws.addressing.MAPAggregator.addressingDisabled", Boolean.TRUE);
    }
}
Also used : AddressingFeature(javax.xml.ws.soap.AddressingFeature) WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature)

Example 57 with AddressingFeature

use of javax.xml.ws.soap.AddressingFeature in project cxf by apache.

the class DispatchClientServerTest method testJAXBObjectPAYLOADFromEPR.

@Test
public void testJAXBObjectPAYLOADFromEPR() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(wsdl);
    SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
    assertNotNull(service);
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.address("http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort");
    builder.serviceName(SERVICE_NAME);
    builder.endpointName(PORT_NAME);
    W3CEndpointReference w3cEpr = builder.build();
    JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
    Dispatch<Object> disp = service.createDispatch(w3cEpr, jc, Service.Mode.PAYLOAD, new AddressingFeature());
    doJAXBPayload(disp);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) AddressingFeature(javax.xml.ws.soap.AddressingFeature) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) JAXBContext(javax.xml.bind.JAXBContext) URL(java.net.URL) Test(org.junit.Test)

Example 58 with AddressingFeature

use of javax.xml.ws.soap.AddressingFeature in project cxf by apache.

the class WSSecurityClientTest method createUsernameTokenDispatcher.

private static Dispatch<Source> createUsernameTokenDispatcher(boolean decoupled, String port) {
    final Service service = Service.create(GREETER_SERVICE_QNAME);
    service.addPort(USERNAME_TOKEN_PORT_QNAME, decoupled ? SOAPBinding.SOAP11HTTP_BINDING : HTTPBinding.HTTP_BINDING, "http://localhost:" + port + "/GreeterService/UsernameTokenPort");
    final Dispatch<Source> dispatcher = service.createDispatch(USERNAME_TOKEN_PORT_QNAME, Source.class, Service.Mode.MESSAGE, new AddressingFeature(decoupled, decoupled));
    final java.util.Map<String, Object> requestContext = dispatcher.getRequestContext();
    requestContext.put(MessageContext.HTTP_REQUEST_METHOD, "POST");
    if (decoupled) {
        HTTPConduit cond = (HTTPConduit) ((DispatchImpl<?>) dispatcher).getClient().getConduit();
        cond.getClient().setDecoupledEndpoint("http://localhost:" + DEC_PORT + "/decoupled");
    }
    return dispatcher;
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) AddressingFeature(javax.xml.ws.soap.AddressingFeature) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) Service(javax.xml.ws.Service) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Example 59 with AddressingFeature

use of javax.xml.ws.soap.AddressingFeature in project cxf by apache.

the class JMSClientServerTest method testOneWayQueueConnection.

@Test
public void testOneWayQueueConnection() throws Exception {
    QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldOneWayQueueService");
    QName portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldOneWayQueuePort");
    URL wsdl = getWSDLURL("/wsdl/jms_test.wsdl");
    HelloWorldOneWayQueueService service = new HelloWorldOneWayQueueService(wsdl, serviceName);
    HelloWorldOneWayPort greeter = service.getPort(portName, HelloWorldOneWayPort.class, new AddressingFeature(true, true));
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("JMS:Queue:Milestone-" + idx);
    }
    // Give some time to complete one-way calls.
    Thread.sleep(100L);
    ((java.io.Closeable) greeter).close();
}
Also used : HelloWorldOneWayPort(org.apache.cxf.hello_world_jms.HelloWorldOneWayPort) AddressingFeature(javax.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Closeable(java.io.Closeable) HelloWorldOneWayQueueService(org.apache.cxf.hello_world_jms.HelloWorldOneWayQueueService) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Example 60 with AddressingFeature

use of javax.xml.ws.soap.AddressingFeature in project cxf by apache.

the class WSADisableTest method testDiaptchWithWsaDisable.

@Test
public void testDiaptchWithWsaDisable() throws Exception {
    QName port = new QName("http://apache.org/cxf/systest/ws/addr_feature/", "AddNumbersPort");
    Dispatch<SOAPMessage> disptch = getService().createDispatch(port, SOAPMessage.class, javax.xml.ws.Service.Mode.MESSAGE, new AddressingFeature(false));
    ((BindingProvider) disptch).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    InputStream is = getClass().getResourceAsStream("resources/AddNumbersDispatchReq.xml");
    SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
    assertNotNull(soapReqMsg);
    try {
        disptch.invoke(soapReqMsg);
        fail("The MAPcodec ate the SOAPFaultException");
    } catch (javax.xml.ws.soap.SOAPFaultException e) {
    // expected
    }
}
Also used : AddressingFeature(javax.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) InputStream(java.io.InputStream) SOAPMessage(javax.xml.soap.SOAPMessage) Test(org.junit.Test)

Aggregations

AddressingFeature (javax.xml.ws.soap.AddressingFeature)67 BindingProvider (javax.xml.ws.BindingProvider)35 URL (java.net.URL)18 QName (javax.xml.namespace.QName)13 Test (org.junit.Test)13 Service (javax.xml.ws.Service)8 ArrayList (java.util.ArrayList)7 WebServiceFeature (javax.xml.ws.WebServiceFeature)7 MTOMFeature (javax.xml.ws.soap.MTOMFeature)7 MAP (org.jboss.ws.api.addressing.MAP)5 RespectBindingFeature (javax.xml.ws.RespectBindingFeature)4 LinkedList (java.util.LinkedList)3 DispatchImpl (org.apache.cxf.jaxws.DispatchImpl)3 WSAddressingFeature (org.apache.cxf.ws.addressing.WSAddressingFeature)3 SoapFaultPortType (org.jboss.jbossts.xts.soapfault.SoapFaultPortType)3 CoordinationContextHandler (com.jboss.transaction.txinterop.webservices.handlers.CoordinationContextHandler)2 Sc007Service (com.jboss.transaction.wstf.webservices.sc007.generated.Sc007Service)2 WSBinding (com.sun.xml.ws.api.WSBinding)2 ServletAdapterList (com.sun.xml.ws.transport.http.servlet.ServletAdapterList)2 Closeable (java.io.Closeable)2