Search in sources :

Example 26 with Service

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

the class AddNumbersClient method createDispatchWithoutWSDL.

private Dispatch<SOAPMessage> createDispatchWithoutWSDL() throws Exception {
    Service service = Service.create(SERVICE_QNAME);
    service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING, getAddress());
    // MemberSubmissionAddressingFeature msAddressingFeature = new MemberSubmissionAddressingFeature(true);
    // WebServiceFeature[] features = new WebServiceFeature[] {msAddressingFeature};
    WebServiceFeature[] features = null;
    Dispatch<SOAPMessage> dispatch = service.createDispatch(PORT_QNAME, SOAPMessage.class, Service.Mode.MESSAGE, features);
    return dispatch;
}
Also used : WebServiceFeature(jakarta.xml.ws.WebServiceFeature) Service(jakarta.xml.ws.Service) SOAPMessage(jakarta.xml.soap.SOAPMessage)

Example 27 with Service

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

the class ClientEpr method testEprWithDispatchWithoutWSDL.

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);
    w3cEprGettertest(dispatch, false);
    msEprGettertest(dispatch, false);
}
Also used : Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch)

Example 28 with Service

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

the class ClientEpr method testEprWithDispatchWithWSDL.

public void testEprWithDispatchWithWSDL() throws Exception {
    Service service = Service.create(getClass().getResource("../config/HelloService.wsdl"), serviceName);
    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 29 with Service

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

the class AddNumbersTest method doDispatchTesting.

private void doDispatchTesting(String contextPath, String request, Service.Mode mode, Class expectedClass) throws JAXBException {
    JAXBContext jaxbContext = JAXBContext.newInstance(contextPath);
    Unmarshaller u = jaxbContext.createUnmarshaller();
    Object obj = u.unmarshal(new StreamSource(new StringReader(request)));
    LOGGER.finest("---Marshaller parsed and wrote back----\n" + reconstructMsg(jaxbContext, obj) + "\n---------\n");
    Service service = new AddNumbersImplService();
    Dispatch dispatch = service.createDispatch(portQName, jaxbContext, mode);
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "run:tns:AddNumbersService");
    JAXBElement response = (JAXBElement) dispatch.invoke(obj);
    assertTrue(expectedClass.equals(response.getDeclaredType()));
    LOGGER.finest("---result:" + response.getValue().toString() + "---\n" + reconstructMsg(jaxbContext, response) + "\n---------\n");
}
Also used : StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch)

Example 30 with Service

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

the class SOAPAction1Test method testSOAPActionWithDispatch_WithUse_true.

// use is set to true, so action property is effective
public void testSOAPActionWithDispatch_WithUse_true() throws JAXBException {
    TestEndpoint1 port = new TestEndpointService1().getTestEndpointPort1();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService1"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort1"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort1"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD);
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
    JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
    assertEquals(action, r.getValue());
}
Also used : QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) JAXBElement(jakarta.xml.bind.JAXBElement)

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