Search in sources :

Example 6 with SOAPFaultException

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

the class DispatchHello method kktestHelloRequestResponseHelloMsgBadFooXML.

// needs to be looked at
public void kktestHelloRequestResponseHelloMsgBadFooXML() {
    // test for bug6323952
    Dispatch dispatch = getDispatchSource();
    Source source = makeStreamSource(helloMsgBadFoo);
    Source response = makeStreamSource(helloResponse);
    try {
        Source result = (Source) dispatch.invoke(source);
        // assertTrue(result == null);
        // printout result
        // in actuality a soapFaultMessage need to be returned.
        String xmlResult = sourceToXMLString(result);
        System.out.println("Got result : " + xmlResult);
    } catch (Exception e) {
        try {
            assertTrue(e instanceof SOAPFaultException);
            SOAPFaultException sfe = (SOAPFaultException) e;
            if (sfe.getMessage() != null)
                System.out.println("sfe message " + sfe.getMessage());
            System.out.println("e class " + e.getClass().getName());
            if (e.getCause() != null)
                System.out.println("Cause is " + e.getCause().getClass().getName());
            // assertTrue(e instanceof SOAPFaultException);
            System.out.println("testHelloRequestBadFooResponseXML Passed");
        } catch (Exception ex) {
            System.err.println("Expected SOAPFAULTException - got " + ex.getClass().getName());
            System.out.println("testHelloRequestBadFooResponseXML FAILED");
            fail("testHelloRequestBadFooResponseXML FAILED");
        }
    }
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) Source(javax.xml.transform.Source) MalformedURLException(java.net.MalformedURLException) WebServiceException(jakarta.xml.ws.WebServiceException) JAXBException(jakarta.xml.bind.JAXBException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 7 with SOAPFaultException

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

the class DispatchHello method testSQETestXML.

public void testSQETestXML() throws WebServiceException, Exception {
    // System.err.println("----------------Expected Message ----------------------");
    Dispatch dispatch = getDispatchSource();
    Source source = null;
    Source response = null;
    try {
        source = makeStreamSource(sqeTest);
    } catch (Exception e) {
        System.out.println("Error making msg source exiting");
    }
    try {
        Object result = dispatch.invoke(source);
        String xmlResult = sourceToXMLString((Source) result);
        System.out.println("Got result : " + xmlResult);
        assertTrue(result == null);
        System.out.println("sqeXML Passed");
    } catch (Exception ex) {
        assertTrue(ex instanceof SOAPFaultException);
    }
// System.err.println("----------------END Expected Message ----------------------");
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) Source(javax.xml.transform.Source) MalformedURLException(java.net.MalformedURLException) WebServiceException(jakarta.xml.ws.WebServiceException) JAXBException(jakarta.xml.bind.JAXBException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 8 with SOAPFaultException

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

the class AddNumbersClient method testEPRGetPortVI.

// UsingAddressing wsdl:required=true
// AddressingFeature Disabled expect Exception
// Expect no valid port created,
public void testEPRGetPortVI() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    AddNumbersPortType proxy = createStub();
    EndpointReference epr = ((BindingProvider) proxy).getEndpointReference(MemberSubmissionEndpointReference.class);
    RespectBindingFeature feature = new RespectBindingFeature(true);
    MemberSubmissionAddressingFeature addr = new MemberSubmissionAddressingFeature(false, false);
    WebServiceFeature[] features = new WebServiceFeature[] { feature, addr };
    AddNumbersPortType port = epr.getPort(AddNumbersPortType.class, features);
    assertTrue(port != null);
    // expectation is that port is not configured for addressing and the invocation will fail
    try {
        System.out.println("Adding numbers 2 and 4");
        int result = port.addNumbers(2, 4);
    } catch (Exception ex) {
        assertTrue(ex instanceof SOAPFaultException);
        System.out.println(((SOAPFaultException) ex).getFault().getFaultString());
    }
}
Also used : SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) IOException(java.io.IOException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 9 with SOAPFaultException

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

the class AddNumbersClient method testEPRGetPortVI.

public void testEPRGetPortVI() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    AddNumbersPortType proxy = createStub();
    EndpointReference epr = ((BindingProvider) proxy).getEndpointReference(MemberSubmissionEndpointReference.class);
    RespectBindingFeature feature = new RespectBindingFeature(true);
    MemberSubmissionAddressingFeature addr = new MemberSubmissionAddressingFeature(false, false);
    WebServiceFeature[] features = new WebServiceFeature[] { feature, addr };
    AddNumbersPortType port = epr.getPort(AddNumbersPortType.class, features);
    assertTrue(port != null);
    // expectation is that port is not configured for addressing and the invocation will fail
    try {
        System.out.println("Adding numbers 2 and 4");
        int result = port.addNumbers(2, 4);
    } catch (Exception ex) {
        assertTrue(ex instanceof SOAPFaultException);
        System.out.println(((SOAPFaultException) ex).getFault().getFaultString());
    }
}
Also used : SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 10 with SOAPFaultException

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

the class AddNumbersClient method testEPRGetPortVIIII.

public void testEPRGetPortVIIII() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    AddNumbersPortType proxy = createStub();
    // EndpointReference epr = ((BindingProvider) proxy).getEndpointReference(W3CEndpointReference.class);
    EndpointReference epr = ((BindingProvider) proxy).getEndpointReference(MemberSubmissionEndpointReference.class);
    RespectBindingFeature feature = new RespectBindingFeature(true);
    AddressingFeature addr = new AddressingFeature(true, false);
    WebServiceFeature[] features = new WebServiceFeature[] { feature, addr };
    AddNumbersPortType port = epr.getPort(AddNumbersPortType.class, features);
    assertTrue(port != null);
    // expectation is that port is not configured for addressing and the invocation will fail
    try {
        System.out.println("Adding numbers 2 and 4");
        int result = port.addNumbers(2, 4);
    } catch (Exception ex) {
        assertTrue(ex instanceof SOAPFaultException);
        System.out.println(((SOAPFaultException) ex).getFault().getFaultString());
    }
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Aggregations

SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)105 QName (javax.xml.namespace.QName)28 WebServiceException (jakarta.xml.ws.WebServiceException)27 SOAPFault (jakarta.xml.soap.SOAPFault)21 JAXBException (jakarta.xml.bind.JAXBException)16 Dispatch (jakarta.xml.ws.Dispatch)16 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)14 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)12 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)12 MalformedURLException (java.net.MalformedURLException)12 Source (javax.xml.transform.Source)12 HandlerTracker (fromwsdl.handler.common.HandlerTracker)11 HandlerTracker (handler.handler_processing.common.HandlerTracker)11 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)10 Message (com.sun.xml.ws.api.message.Message)9 SAAJMessage (com.sun.xml.ws.message.saaj.SAAJMessage)9 ProtocolException (jakarta.xml.ws.ProtocolException)9 IOException (java.io.IOException)7 SOAPMessage (jakarta.xml.soap.SOAPMessage)6 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)5