Search in sources :

Example 16 with Service

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

the class OnewayTest method getHttpStatus.

private int getHttpStatus(String address) throws Exception {
    QName portName = new QName(NS, "OnewayEndpointPort");
    QName serviceName = new QName(NS, "OnewayEndpointService");
    Service service = Service.create(new URL(address + "?wsdl"), serviceName);
    Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    String body = "<ns0:echoInteger xmlns:ns0='" + NS + "'><arg0>12345</arg0></ns0:echoInteger>";
    d.invokeOneWay(new StreamSource(new StringReader(body)));
    Map<String, Object> rc = ((BindingProvider) d).getResponseContext();
    return (Integer) rc.get(MessageContext.HTTP_RESPONSE_CODE);
}
Also used : QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) Service(jakarta.xml.ws.Service) WebService(jakarta.jws.WebService) BindingProvider(jakarta.xml.ws.BindingProvider) URL(java.net.URL) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Example 17 with Service

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

the class ClientEprTest method testEprWithDispatchWithWSDL.

public void testEprWithDispatchWithWSDL() throws Exception {
    Service service = new HelloService();
    Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    w3cEprGettertest(dispatch, true);
    msEprGettertest(dispatch, true);
}
Also used : Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch)

Example 18 with Service

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

the class WSDLEprExtensionsTest method testEprWithDispatchWithoutWSDL.

/**
 * Tests client-side access to EPR extensions specified in WSDL
 * @throws Exception
 */
public void testEprWithDispatchWithoutWSDL() throws Exception {
    Service service = Service.create(serviceName);
    service.addPort(portName, jakarta.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
    Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
    assertTrue(wsepr.getEPRExtensions().isEmpty());
}
Also used : WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) WSBindingProvider(com.sun.xml.ws.developer.WSBindingProvider) Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch)

Example 19 with Service

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

the class WSDLEprExtensionsTest method testEprWithDispatchWithWSDL.

/**
 * Tests client-side access to EPR extensions specified in WSDL
 * @throws Exception
 */
public void testEprWithDispatchWithWSDL() throws Exception {
    Service service = new HelloService();
    Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
    assertTrue(wsepr.getEPRExtensions().size() == 1);
    WSEndpointReference.EPRExtension idExtn = wsepr.getEPRExtension(new QName("http://schemas.xmlsoap.org/ws/2006/02/addressingidentity", "Identity"));
    assertTrue(idExtn != null && idExtn.getQName().equals(new QName("http://schemas.xmlsoap.org/ws/2006/02/addressingidentity", "Identity")));
}
Also used : QName(javax.xml.namespace.QName) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) WSBindingProvider(com.sun.xml.ws.developer.WSBindingProvider) Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch)

Example 20 with Service

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

the class EprExtensionsContributorTest method testEprWithDispatchWithWSDL.

/**
 * Tests client-side access to EPR extensions specified in WSDL
 *
 * @throws Exception
 */
public void testEprWithDispatchWithWSDL() throws Exception {
    Service service = new HelloService();
    Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
    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 : QName(javax.xml.namespace.QName) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) WSBindingProvider(com.sun.xml.ws.developer.WSBindingProvider) Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch)

Aggregations

Service (jakarta.xml.ws.Service)81 QName (javax.xml.namespace.QName)45 Source (javax.xml.transform.Source)23 StreamSource (javax.xml.transform.stream.StreamSource)21 BindingProvider (jakarta.xml.ws.BindingProvider)17 Dispatch (jakarta.xml.ws.Dispatch)16 URL (java.net.URL)13 StringReader (java.io.StringReader)11 WebService (jakarta.jws.WebService)10 DataSource (jakarta.activation.DataSource)8 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)7 JAXBElement (jakarta.xml.bind.JAXBElement)7 Handler (jakarta.xml.ws.handler.Handler)7 WSBindingProvider (com.sun.xml.ws.developer.WSBindingProvider)6 SOAPMessage (jakarta.xml.soap.SOAPMessage)6 ByteArrayInputStream (java.io.ByteArrayInputStream)6 JAXBContext (jakarta.xml.bind.JAXBContext)5 Binding (jakarta.xml.ws.Binding)5 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)5 SOAPBinding (jakarta.xml.ws.soap.SOAPBinding)5