Search in sources :

Example 16 with MemberSubmissionAddressingFeature

use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersClient method testCustomFault1.

/**
 * This test tests the functionality of OnewayFeature and AddressingFeature the way it being used in WS-AT implementation
 * In WS-AT impl, Server-side has to send fault messages to predefined coordinator and this test replicates that usage.
 *
 * @throws Exception
 */
public void testCustomFault1() throws Exception {
    SOAPFault fault = SOAPFactory.newInstance().createFault("custom fault from client", SOAPConstants.SOAP_SENDER_FAULT);
    WSEndpointReference to = new WSEndpointReference(getAddress(), AddressingVersion.MEMBER);
    OneWayFeature owf = new OneWayFeature();
    owf.setRelatesToID("uuid:foobar");
    WSService service = WSService.create();
    service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING, getAddress());
    Dispatch<Source> dispatch = service.createDispatch(PORT_QNAME, to, Source.class, Service.Mode.PAYLOAD, new MemberSubmissionAddressingFeature(true), owf);
    // Since this fault is not a wsdl operation, we need to set SOAPAction for correct wsa:Action
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://example.com/myfault");
    try {
        dispatch.invokeOneWay(new DOMSource(fault));
    } catch (WebServiceException e) {
    // since the server-side is not provider based for this test.
    // it does n't know from the fault message request that it is oneway and throws 500 code.
    // so, expect a WebServcieException here.
    }
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) OneWayFeature(com.sun.xml.ws.api.addressing.OneWayFeature) WSService(com.sun.xml.ws.api.WSService) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) SOAPFault(jakarta.xml.soap.SOAPFault) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) DOMSource(javax.xml.transform.dom.DOMSource) Source(javax.xml.transform.Source)

Example 17 with MemberSubmissionAddressingFeature

use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersClient method testFaultToRefpsWithWSDL.

// bug RespectBindingFeature will turn off enabled features in the wsdl
// but not features that have been explicitly set by the client
public void testFaultToRefpsWithWSDL() throws Exception {
    try {
        MemberSubmissionAddressingFeature addressingFeature = new MemberSubmissionAddressingFeature(true);
        RespectBindingFeature bindingFeature = new RespectBindingFeature(false);
        WebServiceFeature[] features = new WebServiceFeature[] { addressingFeature, bindingFeature };
        Dispatch dispatch = createDispatchWithWSDL(features);
        BindingImpl binding = (BindingImpl) dispatch.getBinding();
        boolean enabled = AddressingVersion.isEnabled(binding);
        if (enabled) {
            System.out.println("Addressing is Enabled");
        } else {
            System.out.println("Addressing is disabled");
        }
        assertTrue(enabled == true);
        WsaUtils.invoke(dispatch, WsaUtils.FAULT_TO_REFPS_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS, W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS, CORRECT_ACTION);
        fail("SOAPFaultException must be thrown");
    } catch (SOAPFaultException sfe) {
        assertTrue("Got SOAPFaultException", true);
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) RespectBindingFeature(jakarta.xml.ws.RespectBindingFeature) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) Dispatch(jakarta.xml.ws.Dispatch) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)

Example 18 with MemberSubmissionAddressingFeature

use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class WSAActionTest method testMethodInvocation.

// test of runtime configuration - check dump messages
public void testMethodInvocation() {
    WSAAction port = new WSAActionService().getWSAActionPort(new MemberSubmissionAddressingFeature(true));
    port.myWebMethod();
}
Also used : MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)

Example 19 with MemberSubmissionAddressingFeature

use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.

the class WSAActionFromJavaTest method test.

public void test() {
    WSAActionFromJavaService service = new WSAActionFromJavaService();
    setupCheckingHanlder(service);
    WSAActionFromJava port = service.getWSAActionFromJavaPort(new MemberSubmissionAddressingFeature(true));
    port.echo("test");
}
Also used : MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)

Aggregations

MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)19 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)9 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)9 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)6 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)4 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)3 WSService (com.sun.xml.ws.api.WSService)2 OneWayFeature (com.sun.xml.ws.api.addressing.OneWayFeature)2 BindingImpl (com.sun.xml.ws.binding.BindingImpl)2 SOAPFault (jakarta.xml.soap.SOAPFault)2 Dispatch (jakarta.xml.ws.Dispatch)2 RespectBindingFeature (jakarta.xml.ws.RespectBindingFeature)2 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)2 Source (javax.xml.transform.Source)2 DOMSource (javax.xml.transform.dom.DOMSource)2 SOAPMessage (jakarta.xml.soap.SOAPMessage)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1