Search in sources :

Example 1 with Service

use of jakarta.xml.ws.Service in project core by weld.

the class WebServiceInterceptorTest method getEjb3.

private EndpointIface getEjb3() throws Exception {
    final URL wsdlURL = new URL(baseUrl + "EJB3EndpointService/EJB3Endpoint?wsdl");
    final QName serviceName = new QName(TARGET_NAMESPACE, "EJB3EndpointService");
    final Service service = Service.create(wsdlURL, serviceName);
    return service.getPort(EndpointIface.class);
}
Also used : QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) URL(java.net.URL)

Example 2 with Service

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

the class ClientFeatureTest method testSameServiceDifferentDispatch.

public void testSameServiceDifferentDispatch() throws Exception {
    Service service = Service.create(SERVICE_NAME);
    service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, ENDPOINT);
    String encoding = "UTF-16";
    Dispatch<DataSource> dispatch1 = createDispatch(service, encoding);
    validateFeatureList(dispatch1, encoding);
    encoding = null;
    Dispatch<DataSource> dispatch2 = createDispatch(service, encoding);
    validateFeatureList(dispatch2, encoding);
}
Also used : Service(jakarta.xml.ws.Service) DataSource(jakarta.activation.DataSource)

Example 3 with Service

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

the class ThrowableInPacketCompletionTest method testThrowableAsync.

public void testThrowableAsync() {
    Service service = Service.create(SERVICE_NAME, serviceFeatures());
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "http://localhost:7001/TestService/TestPort");
    Dispatch<Packet> dispatch = service.createDispatch(PORT_NAME, Packet.class, Mode.MESSAGE, portFeatures(false));
    Packet request = new Packet();
    try {
        Response<Packet> response = dispatch.invokeAsync(request);
        assertNotNull(response);
        Packet responsePacket = response.get();
        assertNotNull(responsePacket);
        ThrowableContainerPropertySet ps = responsePacket.getSatellite(ThrowableContainerPropertySet.class);
        fail("Exception expected, but got none");
    } catch (Throwable t) {
        assertTrue(t instanceof ExecutionException);
        assertTrue(t.getCause() instanceof WebServiceException);
        assertTrue(t.getCause().getCause() instanceof TestException);
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) WebServiceException(jakarta.xml.ws.WebServiceException) Service(jakarta.xml.ws.Service) ThrowableContainerPropertySet(com.sun.xml.ws.api.pipe.ThrowableContainerPropertySet) ExecutionException(java.util.concurrent.ExecutionException)

Example 4 with Service

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

the class ThrowableInPacketCompletionTest method testThrowableInPacketAsync.

public void testThrowableInPacketAsync() {
    Service service = Service.create(SERVICE_NAME, serviceFeatures());
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "http://localhost:7001/TestService/TestPort");
    Dispatch<Packet> dispatch = service.createDispatch(PORT_NAME, Packet.class, Mode.MESSAGE, portFeatures(true));
    Packet request = new Packet();
    try {
        Response<Packet> response = dispatch.invokeAsync(request);
        assertNotNull(response);
        Packet responsePacket = response.get();
        assertNotNull(responsePacket);
        ThrowableContainerPropertySet ps = responsePacket.getSatellite(ThrowableContainerPropertySet.class);
        assertNotNull(ps);
        assertTrue(ps.getThrowable() instanceof TestException);
    } catch (Throwable t) {
        fail("Exception not expected, but got: " + t.getMessage());
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Service(jakarta.xml.ws.Service) ThrowableContainerPropertySet(com.sun.xml.ws.api.pipe.ThrowableContainerPropertySet)

Example 5 with Service

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

the class ThrowableInPacketCompletionTest method testThrowableInPacket.

public void testThrowableInPacket() {
    Service service = Service.create(SERVICE_NAME, serviceFeatures());
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "http://localhost:7001/TestService/TestPort");
    Dispatch<Packet> dispatch = service.createDispatch(PORT_NAME, Packet.class, Mode.MESSAGE, portFeatures(true));
    Packet request = new Packet();
    try {
        Packet response = dispatch.invoke(request);
        assertNotNull(response);
        ThrowableContainerPropertySet ps = response.getSatellite(ThrowableContainerPropertySet.class);
        assertNotNull(ps);
        assertTrue(ps.getThrowable() instanceof TestException);
    } catch (Throwable t) {
        fail("Exception not expected, but got: " + t.getMessage());
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Service(jakarta.xml.ws.Service) ThrowableContainerPropertySet(com.sun.xml.ws.api.pipe.ThrowableContainerPropertySet)

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