Search in sources :

Example 21 with Service

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

the class EprExtensionsContributorTest 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 22 with Service

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

the class EprExtensionsContributorTest 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 23 with Service

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

the class SOAPAction2Test method testSOAPActionWithDispatch_WithUse_true_WithWSA.

// when use is true, so action is effective
public void testSOAPActionWithDispatch_WithUse_true_WithWSA() throws JAXBException {
    TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
    ((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 : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) JAXBElement(jakarta.xml.bind.JAXBElement)

Example 24 with Service

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

the class SOAPAction2Test method testSOAPActionWithDispatch_WithoutUse_WithWSA.

// when WSA is enabled, use property defaults to true, so action is effective
public void testSOAPActionWithDispatch_WithoutUse_WithWSA() throws JAXBException {
    TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);
    JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
    assertEquals(action, r.getValue());
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) JAXBElement(jakarta.xml.bind.JAXBElement)

Example 25 with Service

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

the class SOAPAction2Test method testSOAPActionWithDispatch_WithUse_false_WithWSA.

// use is false but WSA is enabled, so action is ineffective
public void testSOAPActionWithDispatch_WithUse_false_WithWSA() throws JAXBException {
    TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
    String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
    s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
    Dispatch<Object> d = new TestEndpointService2().createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, dummy_action);
    ((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, false);
    JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
    assertEquals(action, r.getValue());
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) 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