Search in sources :

Example 21 with MemberSubmissionEndpointReference

use of com.sun.xml.ws.developer.MemberSubmissionEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class ClientEpr method w3cEprGettertest.

private void w3cEprGettertest(BindingProvider bp, boolean hasWSDL) throws Exception {
    // validate w3c epr
    W3CEndpointReference w3cEpr = (W3CEndpointReference) bp.getEndpointReference();
    // printEPR(w3cEpr);
    // assertTrue(EprUtil.validateEPR(w3cEpr,endpointAddress, serviceName, portName, portTypeName, hasWSDL));
    assertTrue(EprUtil.validateEPR(w3cEpr, endpointAddress, null, null, null, false));
    // validate ms epr
    MemberSubmissionEndpointReference msEpr = bp.getEndpointReference(MemberSubmissionEndpointReference.class);
    // printEPR(msEpr);
    assertTrue(EprUtil.validateEPR(msEpr, endpointAddress, serviceName, portName, portTypeName, hasWSDL));
}
Also used : W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 22 with MemberSubmissionEndpointReference

use of com.sun.xml.ws.developer.MemberSubmissionEndpointReference 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 23 with MemberSubmissionEndpointReference

use of com.sun.xml.ws.developer.MemberSubmissionEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class ReferenceParametersTest method testReferenceParametersConversion1.

/*
     * Whitebox test for issue564   
     */
/*
    This test has been moved to jaxws-unit test harness so that 2.1.5 tag can be used.
    
    public void testFaultToReferenceParametersJAXBMessage2() throws Exception {
        String requestStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<S:Envelope xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:user=\"http://foo.bar\" " +
                "xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">" +
                "<S:Header>" +
                "<wsa:Action>http://example.org/action/echoIn</wsa:Action>" +
                "<wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>" +
                "<wsa:MessageID>urn:uuid:1234567890</wsa:MessageID>" +
                "<wsa:ReplyTo>" +
                "<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>" +
                "<wsa:ReferenceParameters>" +
                "<user:foo>bar</user:foo>" +
                "<user:bar xmlns:user=\"http://foo.bar\">" +
                "<user:foobar>barfoo</user:foobar>" +
                "</user:bar>" +
                "</wsa:ReferenceParameters>" +
                "</wsa:ReplyTo>" +
                "<wsa:FaultTo>" +
                "<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>" +
                "<wsa:ReferenceParameters>" +
                "<user:foo>bar</user:foo>" +
                "<user:bar xmlns:user=\"http://foo.bar\">" +
                "<user:foobar>barfoo</user:foobar>" +
                "</user:bar>" +
                "</wsa:ReferenceParameters>" +
                "</wsa:FaultTo>" +
                "</S:Header>" +
                "<S:Body>" +
                "<addNumbers xmlns=\"http://example.com/\">" +
                "<number1>10</number1>" +
                "<number2>10</number2>" +
                "</addNumbers>" +
                "</S:Body></S:Envelope>";
        Message message = useStream12Codec(requestStr);
        WSEndpointReference wsepr = message.getHeaders().getFaultTo(AddressingVersion.MEMBER, SOAPVersion.SOAP_12);
        Message m2 = Messages.create("Test Unsupported",AddressingVersion.MEMBER,SOAPVersion.SOAP_12);
        wsepr.addReferenceParameters(m2.getHeaders());
        ByteArrayBuffer baos = new ByteArrayBuffer();
        XMLStreamWriter writer = XMLStreamWriterFactory.create(baos);
        m2.writeTo(writer);
        writer.flush();

        XMLInputFactory readerFactory = XMLInputFactory.newInstance();
        XMLStreamReader reader = readerFactory.createXMLStreamReader(baos.newInputStream());
        Message sm = Messages.create(reader);
        Packet sm_packet = new Packet(sm);
        List<Element> refParams = sm_packet.getReferenceParameters();
        assertEquals("Did n't get expected ReferenceParameters",2,refParams.size());
        for(Element e: refParams) {
            assertEquals("NS Decl did not match", "http://foo.bar", e.getNamespaceURI());
        }
    }
    */
public void testReferenceParametersConversion1() throws Exception {
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    docFactory.setNamespaceAware(true);
    DocumentBuilder db = docFactory.newDocumentBuilder();
    Document doc = db.newDocument();
    Element el1 = doc.createElementNS("http:foo.bar", "Element1");
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    EndpointReference epr = builder.address("http://foo.bar").referenceParameter(el1).build();
    System.out.println("EPR " + epr);
    WSEndpointReference wsepr = new WSEndpointReference(epr);
    MemberSubmissionEndpointReference translated = wsepr.toSpec(MemberSubmissionEndpointReference.class);
    // System.out.println(translated);
    assert (translated.referenceParameters.elements.size() == 1);
}
Also used : W3CEndpointReferenceBuilder(jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Element(org.w3c.dom.Element) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) Document(org.w3c.dom.Document) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference)

Example 24 with MemberSubmissionEndpointReference

use of com.sun.xml.ws.developer.MemberSubmissionEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class HelloLiteralTest method testDispatchGetMSEPRFromClass.

// functionality needs to be clarrified
public void testDispatchGetMSEPRFromClass() {
    EndpointReference epr = ((BindingProvider) getDispatchSource()).getEndpointReference(MemberSubmissionEndpointReference.class);
    assertTrue(epr != null);
    assertTrue(epr instanceof MemberSubmissionEndpointReference);
}
Also used : MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Example 25 with MemberSubmissionEndpointReference

use of com.sun.xml.ws.developer.MemberSubmissionEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class HelloLiteralTest method testGetMSEPRFromClass.

// functionality needs to be clarrified
public void testGetMSEPRFromClass() {
    EndpointReference epr = ((BindingProvider) stub).getEndpointReference(MemberSubmissionEndpointReference.class);
    assertTrue(epr != null);
    assertTrue(epr instanceof MemberSubmissionEndpointReference);
}
Also used : MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Aggregations

MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)31 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)13 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)8 Element (org.w3c.dom.Element)7 Endpoint (jakarta.xml.ws.Endpoint)6 EndpointReference (jakarta.xml.ws.EndpointReference)6 W3CEndpointReferenceBuilder (jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)6 URL (java.net.URL)6 ArrayList (java.util.ArrayList)6 DocumentBuilder (javax.xml.parsers.DocumentBuilder)6 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)6 Source (javax.xml.transform.Source)6 Document (org.w3c.dom.Document)6 StreamSource (javax.xml.transform.stream.StreamSource)5 JAXBElement (jakarta.xml.bind.JAXBElement)4 HashMap (java.util.HashMap)3 QName (javax.xml.namespace.QName)3 DOMResult (javax.xml.transform.dom.DOMResult)3 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)2 JAXBContext (jakarta.xml.bind.JAXBContext)2