Search in sources :

Example 16 with W3CEndpointReferenceBuilder

use of jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder in project metro-jax-ws by eclipse-ee4j.

the class HelloLiteralTest method testEchoArray.

// Tests epr overriding
// epr(1 reference parameter) passed as argument overrides epr in wsdl(2 reference parameters)
public void testEchoArray() throws Exception {
    try {
        String xmlParam1 = "<myns:MyParam1 xmlns:myns=\"http://cptestservice.org/wsdl\">Hello</myns:MyParam1>";
        Node n1 = DOMUtil.createDOMNode(new ByteArrayInputStream(xmlParam1.getBytes()));
        String endpointAddress = (String) ((BindingProvider) stub).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
        W3CEndpointReferenceBuilder eprBuilder = new W3CEndpointReferenceBuilder();
        eprBuilder.address(endpointAddress);
        eprBuilder.referenceParameter((Element) n1.getFirstChild());
        W3CEndpointReference epr = eprBuilder.build();
        Hello_Service service = new Hello_Service();
        Hello newStub = service.getPort(epr, Hello.class);
        String[] in = { "JAXRPC 1.0", "JAXRPC 1.1", "JAXRPC 1.1.2", "JAXRPC 2.0" };
        NameType nt = new NameType();
        nt.getName().add(in[0]);
        nt.getName().add(in[1]);
        nt.getName().add(in[2]);
        nt.getName().add(in[3]);
        jakarta.xml.ws.Holder<NameType> req = new jakarta.xml.ws.Holder<NameType>(nt);
        newStub.echoArray(req);
        assertTrue(req.value == null);
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
}
Also used : Node(org.w3c.dom.Node) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) W3CEndpointReferenceBuilder(jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) ByteArrayInputStream(java.io.ByteArrayInputStream) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) jakarta.xml.ws(jakarta.xml.ws)

Aggregations

W3CEndpointReferenceBuilder (jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)16 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)10 Document (org.w3c.dom.Document)8 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)6 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)6 EndpointReference (jakarta.xml.ws.EndpointReference)6 DocumentBuilder (javax.xml.parsers.DocumentBuilder)6 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)6 Element (org.w3c.dom.Element)6 StreamResult (javax.xml.transform.stream.StreamResult)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 DOMResult (javax.xml.transform.dom.DOMResult)3 Node (org.w3c.dom.Node)3 JAXBContext (jakarta.xml.bind.JAXBContext)2 JAXBException (jakarta.xml.bind.JAXBException)2 JAXBResult (jakarta.xml.bind.util.JAXBResult)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 DOMSource (javax.xml.transform.dom.DOMSource)2