Search in sources :

Example 26 with W3CEndpointReference

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

the class EprMarshalUnmarshalTester method testMSEprMarshalling.

public void testMSEprMarshalling() throws JAXBException {
    HelloService service = new HelloService();
    BindingProvider bp = (BindingProvider) service.getHelloPort();
    // validate w3c epr
    W3CEndpointReference w3cEpr = (W3CEndpointReference) bp.getEndpointReference();
    w3cEpr.writeTo(new StreamResult(System.out));
    // assertTrue(EprUtil.validateEPR(w3cEpr, endpointAddress, serviceName, portName, portTypeName, true));
    assertTrue(EprUtil.validateEPR(w3cEpr, endpointAddress, null, null, null, false));
    Marshaller m = jaxbCtx.createMarshaller();
    DOMResult w3cResult = new DOMResult();
    m.marshal(w3cEpr, w3cResult);
    // assertTrue(EprUtil.validateEPR(w3cResult.getNode(), W3CEndpointReference.class, endpointAddress, serviceName, portName, portTypeName, true));
    assertTrue(EprUtil.validateEPR(w3cResult.getNode(), W3CEndpointReference.class, endpointAddress, null, null, null, false));
    // validate ms epr
    MemberSubmissionEndpointReference msEpr = bp.getEndpointReference(MemberSubmissionEndpointReference.class);
    w3cEpr.writeTo(new StreamResult(System.out));
    assertTrue(EprUtil.validateEPR(msEpr, endpointAddress, serviceName, portName, portTypeName, false));
    DOMResult msResult = new DOMResult();
    m.marshal(msEpr, msResult);
    assertTrue(EprUtil.validateEPR(msResult.getNode(), MemberSubmissionEndpointReference.class, endpointAddress, serviceName, portName, portTypeName, true));
}
Also used : Marshaller(jakarta.xml.bind.Marshaller) DOMResult(javax.xml.transform.dom.DOMResult) StreamResult(javax.xml.transform.stream.StreamResult) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) BindingProvider(jakarta.xml.ws.BindingProvider) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 27 with W3CEndpointReference

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

the class EprMarshalUnmarshalTester method testW3CEPRBuilder.

public void testW3CEPRBuilder() 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 metadata = "<myMetadata>This is not useful metadata</myMetadata>";
        Node n2 = createDOMNodeNoNS(new ByteArrayInputStream(metadata.getBytes()));
        W3CEndpointReferenceBuilder eprBuilder = new W3CEndpointReferenceBuilder();
        eprBuilder.address(endpointAddress);
        eprBuilder.referenceParameter((Element) n1.getFirstChild());
        eprBuilder.metadata((Element) n2.getFirstChild());
        W3CEndpointReference epr = eprBuilder.build();
        epr.writeTo(new StreamResult(System.out));
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
}
Also used : W3CEndpointReferenceBuilder(jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) StreamResult(javax.xml.transform.stream.StreamResult) ByteArrayInputStream(java.io.ByteArrayInputStream) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) Node(org.w3c.dom.Node) IOException(java.io.IOException) JAXBException(jakarta.xml.bind.JAXBException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 28 with W3CEndpointReference

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

the class AddNumbersClient method testDefaultOutputAction.

public void testDefaultOutputAction() throws Exception {
    if (ClientServerTestUtil.useLocal()) {
        return;
    }
    AddNumbers proxy = createProxy();
    W3CEndpointReference epr = proxy.getW3CEPR();
    System.out.println("---------------------------------------");
    epr.writeTo(new StreamResult(System.out));
    System.out.println("---------------------------------------");
    // EprUtil.validateEPR(epr, endpointAddress, serviceName, portName, portTypeName, Boolean.TRUE);
    EprUtil.validateEPR(epr, endpointAddress, null, null, null, false);
// AddNumbers newProxy = epr.getPort(AddNumbers.class);
// int result = newProxy.addNumbersNoAction(10, 10);
// assertEquals(20, result);
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference)

Example 29 with W3CEndpointReference

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

the class HelloLiteralTest method testDispatchWithPortsGetW3CEPRFromClass.

public void testDispatchWithPortsGetW3CEPRFromClass() {
    if (ClientServerTestUtil.useLocal()) {
        System.out.println("http transport only exiting");
        return;
    }
    EndpointReference epr = ((BindingProvider) getDispatchSOAPMessageSourceWithPorts()).getEndpointReference(W3CEndpointReference.class);
    assertTrue(epr != null);
    assertTrue(epr instanceof W3CEndpointReference);
}
Also used : W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 30 with W3CEndpointReference

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

the class HelloLiteralTest method testGetW3CEPRFromClass.

public void testGetW3CEPRFromClass() {
    EndpointReference epr = ((BindingProvider) stub).getEndpointReference(W3CEndpointReference.class);
    assertTrue(epr != null);
    assertTrue(epr instanceof W3CEndpointReference);
}
Also used : W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Aggregations

W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)44 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)19 W3CEndpointReferenceBuilder (jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)10 StreamResult (javax.xml.transform.stream.StreamResult)9 StreamSource (javax.xml.transform.stream.StreamSource)9 Endpoint (jakarta.xml.ws.Endpoint)6 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 QName (javax.xml.namespace.QName)5 Source (javax.xml.transform.Source)5 DOMResult (javax.xml.transform.dom.DOMResult)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 URL (java.net.URL)4 ArrayList (java.util.ArrayList)4 Node (org.w3c.dom.Node)3 JAXBContext (jakarta.xml.bind.JAXBContext)2 JAXBException (jakarta.xml.bind.JAXBException)2 Marshaller (jakarta.xml.bind.Marshaller)2 JAXBResult (jakarta.xml.bind.util.JAXBResult)2 BindingProvider (jakarta.xml.ws.BindingProvider)2