Search in sources :

Example 26 with SOAPMessage

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

the class AddNumbersClient method testDispatchEPRGetPort.

// UsingAddressing wsdl:required=true
public void testDispatchEPRGetPort() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    Dispatch<SOAPMessage> dispatch = createDispatchWithWSDL();
    EndpointReference epr = dispatch.getEndpointReference(MemberSubmissionEndpointReference.class);
    // wsdl has addressing required
    AddNumbersPortType port = epr.getPort(AddNumbersPortType.class);
    assertTrue(port != null);
    System.out.println("Adding numbers 2 and 4");
    int result = port.addNumbers(2, 4);
    assert (result == 6);
    System.out.println("Addinion of 2 and 4 successful");
}
Also used : SOAPMessage(jakarta.xml.soap.SOAPMessage) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 27 with SOAPMessage

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

the class AddNumbersClient method testDispatchEPRGetPort.

public void testDispatchEPRGetPort() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    Dispatch<SOAPMessage> dispatch = createDispatchWithWSDL();
    EndpointReference epr = dispatch.getEndpointReference(MemberSubmissionEndpointReference.class);
    // wsdl has addressing required
    AddNumbersPortType port = epr.getPort(AddNumbersPortType.class);
    assertTrue(port != null);
    System.out.println("Adding numbers 2 and 4");
    int result = port.addNumbers(2, 4);
    assert (result == 6);
    System.out.println("Addinion of 2 and 4 successful");
}
Also used : SOAPMessage(jakarta.xml.soap.SOAPMessage) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 28 with SOAPMessage

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

the class AddNumbersClient method testCreateDispatchSMWsdlWEPR.

public void testCreateDispatchSMWsdlWEPR() throws Exception {
    String eprString = "<EndpointReference xmlns=\"http://www.w3.org/2005/08/addressing\"><Address>" + "http://localhost:8080/jaxrpc-client_jaxws21_service_dispatch_features/hello</Address>" + "<Metadata><wsaw:ServiceName xmlns:wsaw=\"http://www.w3.org/2006/05/addressing/wsdl\" xmlns:wsns=\"http://example.com/\" EndpointName=\"AddNumbersPort\">wsns:AddNumbersService</wsaw:ServiceName>" + "</Metadata></EndpointReference>";
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    RespectBindingFeature rbf = new RespectBindingFeature(false);
    WebServiceFeature[] wse = new WebServiceFeature[] { rbf };
    Service service = createServiceWithWSDL();
    EndpointReference w3cEPR = createEPRStubServiceWithWSDL(service);
    // W3CEPRString = w3cEPR.toString();
    W3CEPRString = eprString;
    Dispatch<SOAPMessage> dispatch = service.createDispatch(EndpointReference.readFrom(makeStreamSource(W3CEPRString)), SOAPMessage.class, Service.Mode.MESSAGE);
    SOAPMessage sm = dispatch.invoke(getSOAPMessage(makeStreamSource(SMMsg)));
    sm.writeTo(System.out);
// System.out.println("Adding numbers 2 and 4");
// int result = dispatch.invoke(getSOAPMessage())
// assert(result == 6);
// System.out.println("Addinion of 2 and 4 successful");
}
Also used : SOAPMessage(jakarta.xml.soap.SOAPMessage) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 29 with SOAPMessage

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

the class DispatchHelloLiteralTest method testHelloAsyncPollSOAPMessage.

public void testHelloAsyncPollSOAPMessage() throws Exception {
    Dispatch dispatch = getDispatchSOAPMessage();
    SOAPMessage msg = getSOAPMessage(makeStreamSource(helloSM));
    try {
        Response<SOAPMessage> result = dispatch.invokeAsync(msg);
        assertTrue(result != null);
        SOAPMessage resultmsg = result.get();
        assertTrue(resultmsg != null);
        System.out.println("-----------------------------------------");
        System.out.println("SOAPMessage Result = ");
        resultmsg.writeTo(System.out);
        System.out.println("-----------------------------------------");
    } catch (Exception e) {
        e.printStackTrace();
        fail("Test fails");
    }
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) SOAPMessage(jakarta.xml.soap.SOAPMessage)

Example 30 with SOAPMessage

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

the class AddNumbersClient method testDispatchEPRGetPort.

public void testDispatchEPRGetPort() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("HTTP Transport Only Exiting");
        return;
    }
    Dispatch<SOAPMessage> dispatch = createDispatchWithWSDL();
    EndpointReference epr = dispatch.getEndpointReference(MemberSubmissionEndpointReference.class);
    // wsdl has addressing required
    AddNumbersPortType port = epr.getPort(AddNumbersPortType.class);
    assertTrue(port != null);
    System.out.println("Adding numbers 2 and 4");
    int result = port.addNumbers(2, 4);
    assert (result == 6);
    System.out.println("Addinion of 2 and 4 successful");
}
Also used : SOAPMessage(jakarta.xml.soap.SOAPMessage) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Aggregations

SOAPMessage (jakarta.xml.soap.SOAPMessage)181 MessageFactory (jakarta.xml.soap.MessageFactory)66 ByteArrayInputStream (java.io.ByteArrayInputStream)51 SOAPBody (jakarta.xml.soap.SOAPBody)37 SOAPException (jakarta.xml.soap.SOAPException)36 QName (javax.xml.namespace.QName)31 MimeHeaders (jakarta.xml.soap.MimeHeaders)27 Source (javax.xml.transform.Source)25 StreamSource (javax.xml.transform.stream.StreamSource)25 WebServiceException (jakarta.xml.ws.WebServiceException)24 ByteArrayOutputStream (java.io.ByteArrayOutputStream)21 SAAJMessage (com.sun.xml.ws.message.saaj.SAAJMessage)19 Element (org.w3c.dom.Element)18 Node (org.w3c.dom.Node)18 Packet (com.sun.xml.ws.api.message.Packet)17 Message (com.sun.xml.ws.api.message.Message)16 Iterator (java.util.Iterator)14 SOAPElement (jakarta.xml.soap.SOAPElement)12 AttachmentPart (jakarta.xml.soap.AttachmentPart)11 Dispatch (jakarta.xml.ws.Dispatch)10