Search in sources :

Example 56 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class WSEndpointReferenceTest method testCreateViaSpec.

public void testCreateViaSpec() throws Exception {
    W3CEndpointReference spec = new W3CEndpointReference(new StreamSource(getClass().getResource("test-epr.xml").toExternalForm()));
    new WSEndpointReference(spec, W3C);
}
Also used : W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) StreamSource(javax.xml.transform.stream.StreamSource) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Example 57 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class WSEndpointReferenceTest method testCreateViaBuffer.

public void testCreateViaBuffer() throws Exception {
    WSEndpointReference epr = createEPR();
    System.out.println(epr.toString());
}
Also used : WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Example 58 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class WSEndpointReferenceTest method creaateSubtreeEPR.

/**
 * This creates {@link WSEndpointReference} that uses a fragment infoset.
 * We should really fix this in XMLStreamBuffer.
 */
private WSEndpointReference creaateSubtreeEPR() throws XMLStreamException {
    XMLStreamBuffer xsb = XMLStreamBuffer.createNewBufferFromXMLStreamReader(XMLInputFactory.newInstance().createXMLStreamReader(getClass().getResourceAsStream("test-epr.xml")));
    StreamReaderBufferProcessor p = xsb.readAsXMLStreamReader();
    XMLStreamBuffer mark = p.nextTagAndMark();
    return new WSEndpointReference(mark, W3C);
}
Also used : WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) XMLStreamBuffer(com.sun.xml.stream.buffer.XMLStreamBuffer) StreamReaderBufferProcessor(com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor)

Example 59 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class WSEndpointReferenceTest method testAddress.

public void testAddress() throws Exception {
    WSEndpointReference epr = createEPR();
    assertEquals("http://example.com/fabrikam/acct", epr.getAddress());
}
Also used : WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Example 60 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class WSAM_EPRTester method runOptionalEPRTests.

private void runOptionalEPRTests() throws Exception {
    URL res = getClass().getClassLoader().getResource("epr/wsamTest.wsdl");
    // assuming that this is a file:// URL.
    File folder = new File(new File(res.getFile()).getParentFile(), "optional");
    System.out.println("\n\nOptional Tests:\n");
    for (File f : folder.listFiles()) {
        if (!f.getName().endsWith(".xml"))
            continue;
        System.out.println("***************************");
        System.out.println("TestFile: " + f.getParentFile().getName() + "/" + f.getName());
        try {
            InputStream is = new FileInputStream(f);
            StreamSource s = new StreamSource(is);
            EndpointReference epr = EndpointReference.readFrom(s);
            WSEndpointReference wsepr = new WSEndpointReference(epr);
            System.out.println("Address: " + wsepr.getAddress());
            WSEndpointReference.Metadata metadata = wsepr.getMetaData();
            System.out.println("Metadata Valid?: true");
            if (metadata.getPortTypeName() != null)
                System.out.println("InterfaceName: " + metadata.getPortTypeName());
            if (metadata.getServiceName() != null)
                System.out.println("ServiceName: " + metadata.getServiceName());
            if (metadata.getPortName() != null)
                System.out.println("Endpoint: " + metadata.getPortName().getLocalPart());
            String wsdliLocation = metadata.getWsdliLocation();
            if (metadata.getWsdliLocation() != null) {
                System.out.println("wsdli:wsdlLocation: " + wsdliLocation);
                String wsdlLocation = wsdliLocation.substring(wsdliLocation.lastIndexOf(" "));
                WSDLModel wsdlModel = RuntimeWSDLParser.parse(new URL(wsdlLocation), new StreamSource(wsdlLocation), XmlUtil.createDefaultCatalogResolver(), false, Container.NONE, ServiceFinder.find(WSDLParserExtension.class).toArray());
                QName binding = wsdlModel.getBinding(metadata.getServiceName(), metadata.getPortName()).getName();
                System.out.println("Binding from WSDL: " + binding);
            }
            System.out.println("");
        } catch (Exception e) {
            System.out.println("Metadata Valid?: false");
            System.out.println("Reason: " + e.getMessage());
            // e.printStackTrace();
            System.out.println("");
        }
    }
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) WSDLModel(com.sun.xml.ws.api.model.wsdl.WSDLModel) File(java.io.File) URL(java.net.URL) FileInputStream(java.io.FileInputStream) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference)

Aggregations

WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)80 QName (javax.xml.namespace.QName)32 Element (org.w3c.dom.Element)17 URL (java.net.URL)16 StreamSource (javax.xml.transform.stream.StreamSource)16 EndpointReference (jakarta.xml.ws.EndpointReference)13 WSBindingProvider (com.sun.xml.ws.developer.WSBindingProvider)11 SAAJMessage (com.sun.xml.ws.message.saaj.SAAJMessage)11 SOAPMessage (jakarta.xml.soap.SOAPMessage)11 Packet (com.sun.xml.ws.api.message.Packet)10 XMLStreamReader (javax.xml.stream.XMLStreamReader)10 Message (com.sun.xml.ws.api.message.Message)9 WebServiceException (jakarta.xml.ws.WebServiceException)9 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)8 ByteArrayInputStream (java.io.ByteArrayInputStream)8 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)6 MessageFactory (jakarta.xml.soap.MessageFactory)6 MimeHeaders (jakarta.xml.soap.MimeHeaders)6 Service (jakarta.xml.ws.Service)6 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)6