Search in sources :

Example 6 with W3CEndpointReference

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

the class W3CEprTest method testWriteTo.

public void testWriteTo() {
    StreamSource source = new StreamSource(new ByteArrayInputStream(epr.getBytes()));
    W3CEndpointReference epr = new W3CEndpointReference(source);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    epr.writeTo(new StreamResult(baos));
    System.out.println(baos.toString());
    // dummy assertion
    assertTrue(baos.toString().contains("xmlns:wsns=\"http://foobar.org/\""));
}
Also used : StreamResult(javax.xml.transform.stream.StreamResult) ByteArrayInputStream(java.io.ByteArrayInputStream) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) StreamSource(javax.xml.transform.stream.StreamSource) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 7 with W3CEndpointReference

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

the class W3CEPRTest method testW3CEprBuilder_withWSDL_ServiceName.

public void testW3CEprBuilder_withWSDL_ServiceName() throws Exception {
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder = builder.address(getEndpointAddress());
    builder = builder.serviceName(SERVICE_QNAME);
    builder = builder.endpointName(PORT_QNAME);
    builder = builder.wsdlDocumentLocation(getEndpointAddress() + "?wsdl");
    DOMSource domsrc = makeDOMSource(xmlRefParam1);
    Document document = (Document) domsrc.getNode();
    builder = builder.referenceParameter(document.getDocumentElement());
    domsrc = makeDOMSource(xmlRefParam2);
    document = (Document) domsrc.getNode();
    builder = builder.referenceParameter(document.getDocumentElement());
    W3CEndpointReference epr = builder.build();
    DOMResult result = new DOMResult();
    epr.writeTo(result);
    assertTrue(EprUtil.validateEPR(result.getNode(), W3CEndpointReference.class, getEndpointAddress(), SERVICE_QNAME, PORT_QNAME, null, getEndpointAddress() + "?wsdl"));
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
// epr.writeTo(new StreamResult(baos));
// baos.writeTo(System.out);
}
Also used : W3CEndpointReferenceBuilder(jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) DOMSource(javax.xml.transform.dom.DOMSource) DOMResult(javax.xml.transform.dom.DOMResult) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) Document(org.w3c.dom.Document)

Example 8 with W3CEndpointReference

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

the class W3CEPRTest method testW3CEprBuilder_withWSDL.

public void testW3CEprBuilder_withWSDL() throws Exception {
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder = builder.address(getEndpointAddress());
    builder = builder.wsdlDocumentLocation(getEndpointAddress() + "?wsdl");
    W3CEndpointReference epr = builder.build();
    DOMResult result = new DOMResult();
    epr.writeTo(result);
    assertTrue(EprUtil.validateEPR(result.getNode(), W3CEndpointReference.class, getEndpointAddress(), null, null, null, null));
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
// epr.writeTo(new StreamResult(baos));
// baos.writeTo(System.out);
}
Also used : W3CEndpointReferenceBuilder(jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) DOMResult(javax.xml.transform.dom.DOMResult) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference)

Example 9 with W3CEndpointReference

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

the class EprExtensionsContributorTest method testEprOnServerSide.

/**
 * Tests server-side access to EPR extensions specified in WSDL
 *
 * @throws Exception
 */
public void testEprOnServerSide() throws Exception {
    HelloService service = new HelloService();
    Hello hello = service.getHelloPort();
    W3CEndpointReference serverEpr = hello.getW3CEPR();
    // printEPR(serverEpr);
    WSEndpointReference wsepr = new WSEndpointReference(serverEpr);
    assertTrue(wsepr.getEPRExtensions().size() == 2);
    WSEndpointReference.EPRExtension idExtn = wsepr.getEPRExtension(new QName("http://example.com/addressingidentity", "Identity"));
    assertTrue(idExtn != null && idExtn.getQName().equals(new QName("http://example.com/addressingidentity", "Identity")));
}
Also used : W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) QName(javax.xml.namespace.QName) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Example 10 with W3CEndpointReference

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

the class HelloLiteralTest method testDispatchGetEPRMethodNoArg.

// functionality above needs to be clarified
public void testDispatchGetEPRMethodNoArg() {
    EndpointReference epr = ((BindingProvider) getDispatchJAXB()).getEndpointReference();
    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