Search in sources :

Example 36 with AddressingFeature

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

the class TubelineAssemblerFactoryImplTest method testDispatch.

/**
 * Execute a sequence that corresponds to:
 * <pre>
 *   Service.createService(null, serviceName);
 *   Service.addPort(portName, bindingId, address);
 * </pre>
 */
private Tube testDispatch(String configFileName) throws PolicyException {
    final URL wsdlLocation = null;
    final QName serviceName = new QName(NAMESPACE, "Service1Service");
    // Corresponds to Service.createService(wsdlLocation, serviceName)
    final WSServiceDelegate serviceDelegate = new WSServiceDelegate(wsdlLocation, serviceName, Service.class);
    final QName portName = new QName(NAMESPACE, "Service1Port");
    final BindingID bindingId = BindingID.SOAP11_HTTP;
    // Corresponds to Service.addPort(portName, bindingId, address)
    serviceDelegate.addPort(portName, bindingId.toString(), ADDRESS_URL.toString());
    final EndpointAddress address = new EndpointAddress(ADDRESS_URL);
    final WSDLPort port = null;
    final WSPortInfo portInfo = serviceDelegate.safeGetPort(portName);
    final WSBinding binding = bindingId.createBinding(new AddressingFeature(true));
    final Container container = MockupMetroConfigLoader.createMockupContainer("tubes-config/" + configFileName);
    WSBindingProvider wsbp = new WSBindingProvider() {

        public void setOutboundHeaders(List<Header> headers) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void setOutboundHeaders(Header... headers) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void setOutboundHeaders(Object... headers) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public List<Header> getInboundHeaders() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void setAddress(String address) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public WSEndpointReference getWSEndpointReference() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public WSPortInfo getPortInfo() {
            return portInfo;
        }

        public Map<String, Object> getRequestContext() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public Map<String, Object> getResponseContext() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public Binding getBinding() {
            return binding;
        }

        public EndpointReference getEndpointReference() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void close() throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public ManagedObjectManager getManagedObjectManager() {
            return null;
        }

        public Set<Component> getComponents() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public <S> S getSPI(Class<S> type) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    };
    final ClientTubeAssemblerContext context = new ClientTubeAssemblerContext(address, port, wsbp, binding, container, ((BindingImpl) binding).createCodec(), null, null);
    return getAssembler(bindingId).createClient(context);
}
Also used : WSBinding(com.sun.xml.ws.api.WSBinding) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) BindingID(com.sun.xml.ws.api.BindingID) URL(java.net.URL) WSPortInfo(com.sun.xml.ws.api.client.WSPortInfo) WSDLPort(com.sun.xml.ws.api.model.wsdl.WSDLPort) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference) Container(com.sun.xml.ws.api.server.Container) Header(com.sun.xml.ws.api.message.Header) WSServiceDelegate(com.sun.xml.ws.client.WSServiceDelegate) WSBindingProvider(com.sun.xml.ws.developer.WSBindingProvider) List(java.util.List) Component(com.sun.xml.ws.api.Component) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext) EndpointAddress(com.sun.xml.ws.api.EndpointAddress)

Example 37 with AddressingFeature

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

the class AddNumbersClient method testAddressingWithNoWSDL.

public void testAddressingWithNoWSDL() throws Exception {
    Service service = Service.create(SERVICE_QNAME);
    service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING, getAddress());
    Dispatch<SOAPMessage> dispatch = service.createDispatch(PORT_QNAME, SOAPMessage.class, Service.Mode.MESSAGE, new AddressingFeature());
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, ADD_NUMBERS_ACTION);
    String message = "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body>" + "<addNumbers xmlns=\"http://example.com/\">" + "<number1>10</number1>" + "<number2>10</number2>" + "</addNumbers>" + "</S:Body></S:Envelope>";
    WsaUtils.invoke(dispatch, message);
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) Service(jakarta.xml.ws.Service) SOAPMessage(jakarta.xml.soap.SOAPMessage)

Example 38 with AddressingFeature

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

the class W3CEPRTest method testEPRWithReferenceParameters.

public void testEPRWithReferenceParameters() throws Exception {
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder = builder.address(getEndpointAddress());
    DOMSource domsrc = makeDOMSource(xmlInterfaceName);
    Document document = (Document) domsrc.getNode();
    builder = builder.metadata(document.getDocumentElement());
    builder = builder.serviceName(SERVICE_QNAME);
    builder = builder.endpointName(PORT_QNAME);
    // builder = builder.wsdlDocumentLocation(wsdlurl.toString());
    domsrc = makeDOMSource(xmlRefParam1);
    document = (Document) domsrc.getNode();
    builder = builder.referenceParameter(document.getDocumentElement());
    domsrc = makeDOMSource(xmlRefParam2);
    document = (Document) domsrc.getNode();
    builder = builder.referenceParameter(document.getDocumentElement());
    W3CEndpointReference epr = builder.build();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    epr.writeTo(new StreamResult(baos));
    AddNumbersService service = new AddNumbersService();
    AddNumbersPortType myport = (AddNumbersPortType) service.getPort(epr, AddNumbersPortType.class, new AddressingFeature(true, true));
    myport.addNumbers(10, 10);
}
Also used : W3CEndpointReferenceBuilder(jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) DOMSource(javax.xml.transform.dom.DOMSource) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) StreamResult(javax.xml.transform.stream.StreamResult) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Document(org.w3c.dom.Document)

Example 39 with AddressingFeature

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

the class HelloLiteralTest method testHelloDispatch.

// tests EPR in wsdl
// wsdl epr has two reference parameters
public void testHelloDispatch() throws Exception {
    try {
        String arg = "foo";
        String extra = "bar";
        Hello_Type req = new Hello_Type();
        req.setArgument(arg);
        req.setExtra(extra);
        Hello_Service service = new Hello_Service();
        JAXBContext jc = jakarta.xml.bind.JAXBContext.newInstance(fromwsdl.wsdl_with_epr.client.ObjectFactory.class);
        QName port = new QName("urn:test", "HelloPort");
        Dispatch<Object> dispatch = service.createDispatch(port, jc, Service.Mode.PAYLOAD, new AddressingFeature());
        HelloResponse response = (HelloResponse) dispatch.invoke(req);
        assertEquals(arg, response.getArgument());
        assertEquals(extra, response.getExtra());
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) JAXBContext(jakarta.xml.bind.JAXBContext) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 40 with AddressingFeature

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

the class EndpointFeaturesTest method testCreateImplFeatures.

// Tests Endpoint.create(impl, features)
public void testCreateImplFeatures() throws Exception {
    int port = PortAllocator.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.create(new FeaturesEndpoint(), new AddressingFeature(true, true, AddressingFeature.Responses.ANONYMOUS));
    publishVerifyStop(address, endpoint);
}
Also used : AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint)

Aggregations

AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)41 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)21 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)17 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)16 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)11 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)10 QName (javax.xml.namespace.QName)7 JAXBElement (jakarta.xml.bind.JAXBElement)5 Service (jakarta.xml.ws.Service)5 SOAPMessage (jakarta.xml.soap.SOAPMessage)4 IOException (java.io.IOException)4 BindingImpl (com.sun.xml.ws.binding.BindingImpl)3 JAXBContext (jakarta.xml.bind.JAXBContext)3 BindingProvider (jakarta.xml.ws.BindingProvider)3 Endpoint (jakarta.xml.ws.Endpoint)3 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)3 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 WSBinding (com.sun.xml.ws.api.WSBinding)2 AssertionSet (com.sun.xml.ws.policy.AssertionSet)2