Search in sources :

Example 16 with AddressingFeature

use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class EndpointFeaturesTest method testPublish.

// Tests Endpoint.publish(address, impl, features)
public void testPublish() throws Exception {
    int port = PortAllocator.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.publish(address, new FeaturesEndpoint(), new AddressingFeature(true, true, AddressingFeature.Responses.ANONYMOUS));
    assertTrue(endpoint.isPublished());
    publishVerifyStop(address, endpoint);
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint)

Example 17 with AddressingFeature

use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class SOAPAction2Test method testSOAPActionWithDispatch_WithUse_true_WithWSA.

// when use is true, so action is effective
public void testSOAPActionWithDispatch_WithUse_true_WithWSA() throws JAXBException {
    TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
    JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
    assertEquals(action, r.getValue());
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) JAXBElement(jakarta.xml.bind.JAXBElement)

Example 18 with AddressingFeature

use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class SOAPAction2Test method testSOAPActionWithDispatch_WithoutUse_WithWSA.

// when WSA is enabled, use property defaults to true, so action is effective
public void testSOAPActionWithDispatch_WithoutUse_WithWSA() throws JAXBException {
    TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);
    JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
    assertEquals(action, r.getValue());
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) JAXBElement(jakarta.xml.bind.JAXBElement)

Example 19 with AddressingFeature

use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class SOAPAction2Test method testSOAPActionWithDispatch_WithUse_false_WithWSA.

// use is false but WSA is enabled, so action is ineffective
public void testSOAPActionWithDispatch_WithUse_false_WithWSA() throws JAXBException {
    TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = new TestEndpointService2().createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, dummy_action);
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, false);
    JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
    assertEquals(action, r.getValue());
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) JAXBElement(jakarta.xml.bind.JAXBElement)

Example 20 with AddressingFeature

use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersClient method testMissingActionWithWSDL.

public void testMissingActionWithWSDL() throws Exception {
    try {
        WebServiceFeature[] features = new WebServiceFeature[] { new AddressingFeature(false) };
        Dispatch dispatch = createDispatchWithWSDL(features);
        BindingImpl binding = (BindingImpl) dispatch.getBinding();
        AddressingVersion addressingVersion = AddressingVersion.fromBinding(binding);
        System.out.println("Addressing version is " + addressingVersion);
        assertFalse(AddressingVersion.isEnabled(binding));
        WsaUtils.invoke(dispatch, WsaUtils.MISSING_ACTION_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS);
        fail("SOAPFaultException must be thrown");
    } catch (SOAPFaultException sfe) {
        assertFault(sfe, W3CAddressingConstants.MAP_REQUIRED_QNAME);
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) AddressingVersion(com.sun.xml.ws.api.addressing.AddressingVersion) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) Dispatch(jakarta.xml.ws.Dispatch) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Aggregations

AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)41 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)21 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)17 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)16 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)11 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)10 QName (javax.xml.namespace.QName)7 JAXBElement (jakarta.xml.bind.JAXBElement)5 Service (jakarta.xml.ws.Service)5 SOAPMessage (jakarta.xml.soap.SOAPMessage)4 IOException (java.io.IOException)4 BindingImpl (com.sun.xml.ws.binding.BindingImpl)3 JAXBContext (jakarta.xml.bind.JAXBContext)3 BindingProvider (jakarta.xml.ws.BindingProvider)3 Endpoint (jakarta.xml.ws.Endpoint)3 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)3 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 WSBinding (com.sun.xml.ws.api.WSBinding)2 AssertionSet (com.sun.xml.ws.policy.AssertionSet)2