Example usage for javax.xml.ws.soap SOAPBinding SOAP11HTTP_BINDING

List of usage examples for javax.xml.ws.soap SOAPBinding SOAP11HTTP_BINDING

Introduction

In this page you can find the example usage for javax.xml.ws.soap SOAPBinding SOAP11HTTP_BINDING.

Prototype

String SOAP11HTTP_BINDING

To view the source code for javax.xml.ws.soap SOAPBinding SOAP11HTTP_BINDING.

Click Source Link

Document

A constant representing the identity of the SOAP 1.1 over HTTP binding.

Usage

From source file:org.semispace.ws.client.SemiSpaceProxy.java

protected static WsSpace readSpaceServiceAsStandardPort(String endpointAddress) {
    QName SERVICE_NAME = new QName("http://ws.semispace.org/", "WsSpace");
    QName PORT_NAME = new QName("http://ws.semispace.org/", "WsSpacePort");

    Service service = Service.create(SERVICE_NAME);

    // Add a port to the Service
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);

    WsSpace hw = service.getPort(WsSpace.class);
    return hw;//from  w ww.  j  a v  a2s.  c  o m
}

From source file:org.semispace.ws.client.SemiSpaceTokenProxy.java

protected static TokenWsSpace readSpaceServiceAsStandardPort(String endpointAddress) {
    QName SERVICE_NAME = new QName("http://ws.semispace.org/", "TokenWsSpace");
    QName PORT_NAME = new QName("http://ws.semispace.org/", "TokenWsSpacePort");

    Service service = Service.create(SERVICE_NAME);

    // Add a port to the Service
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);

    TokenWsSpace hw = service.getPort(TokenWsSpace.class);
    return hw;//from  w ww .  j a  v  a  2  s .c om
}

From source file:test.integ.be.fedict.hsm.ws.WSS4JTest.java

@Test
public void testSecurity() throws Exception {
    QName serviceName = new QName("http://www.example.com/test", "TestService");
    Service service = Service.create(serviceName);
    QName portName = new QName("http://www.example.com/test", "TestPort");
    String endpointAddress = this.baseURL + "test";
    LOG.debug("endpoint address: " + endpointAddress);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
    Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
    BindingProvider bindingProvider = (BindingProvider) dispatch;
    SOAPBinding soapBinding = (SOAPBinding) bindingProvider.getBinding();
    List handlerChain = soapBinding.getHandlerChain();
    handlerChain.add(new WSS4JTestSOAPHandler());
    soapBinding.setHandlerChain(handlerChain);
    MessageFactory messageFactory = soapBinding.getMessageFactory();
    SOAPMessage soapMessage = messageFactory.createMessage();
    SOAPBody soapBody = soapMessage.getSOAPBody();
    QName payloadName = new QName("http://www.example.com/test", "Payload", "prefix");
    SOAPBodyElement soapBodyElement = soapBody.addBodyElement(payloadName);
    soapBodyElement.addTextNode("hello world");

    SOAPMessage replyMessage = dispatch.invoke(soapMessage);
}

From source file:org.apache.cxf.systest.jaxrs.JAXRSSoapBookTest.java

@Test
public void testHelloSoap() throws Exception {
    final QName serviceName = new QName("http://hello.com", "HelloWorld");
    final QName portName = new QName("http://hello.com", "HelloWorldPort");
    final String address = "http://localhost:" + PORT + "/test/services/hello-soap";

    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);

    HelloWorld hw = service.getPort(HelloWorld.class);

    useHelloService(hw);//w w  w .j a v a 2  s.com
}

From source file:org.apache.cxf.systest.jaxrs.JAXRSSoapBookTest.java

private void doTestHelloSoapCustomDataBinding(String address) throws Exception {
    final QName serviceName = new QName("http://hello.com", "HelloWorld");
    final QName portName = new QName("http://hello.com", "HelloWorldPort");

    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);

    HelloWorld hw = service.getPort(HelloWorld.class);

    Client cl = ClientProxy.getClient(hw);

    HTTPConduit http = (HTTPConduit) cl.getConduit();

    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(0);
    httpClientPolicy.setReceiveTimeout(0);

    http.setClient(httpClientPolicy);/* w w  w.jav  a2s  .  c om*/

    User user = new UserImpl("Barry");
    User user2 = hw.echoUser(user);

    assertNotSame(user, user2);
    assertEquals("Barry", user2.getName());
}

From source file:io.hummer.util.ws.WebServiceClient.java

private void setRelevantAttributes(EndpointReference epr) {
    try {//from  w w w  .j a  v  a 2s.  c o m
        this.eprParamsAndProps.addAll(epr.getAllReferenceParameters());
        this.eprParamsAndProps.addAll(epr.getAllReferenceProperties());
        if (this.eprParamsAndProps.size() > 0) {
            if (logger.isDebugEnabled())
                logger.trace("Reference Params/Props: " + this.eprParamsAndProps);
        }

        this.endpointURL = epr.getAddress();
        String binding = SOAPBinding.SOAP11HTTP_BINDING;
        try {
            this.serviceName = epr.getServiceName().getServiceName();
            this.portName = new QName(epr.getPortName());
            service = Service.create(this.serviceName);
            service.addPort(portName, binding, this.endpointURL);
        } catch (Exception e) {
            if (endpointURL.contains("wsdl") || endpointURL.contains("WSDL")) {
                // assume that the given URL is a WSDL URL
                String wsdlURL = endpointURL;
                javax.wsdl.Service wsdlService = getSingleWSDLService(wsdlURL);
                this.serviceName = wsdlService.getQName();
                javax.wsdl.Port port = getDefaultWSDLPort(wsdlService);
                if (port instanceof SOAP12Binding)
                    binding = SOAPBinding.SOAP12HTTP_BINDING;
                this.portName = new QName(serviceName.getNamespaceURI(), port.getName());
                this.endpointURL = getAddressFromWSDLPort(port);
                service = Service.create(new URL(wsdlURL), this.serviceName);
            }
        }
    } catch (WSDLException e) {
        throw new RuntimeException("Unable to create Web service client from WSDL.", e);
    } catch (ConnectException e) {
        throw new RuntimeException("Unable to create Web service client.", e);
    } catch (Exception e) {
        // swallow
        logger.info("Error initializing Web service client.", e);
    }
}

From source file:org.apache.cxf.cwiki.SiteExporter.java

public static synchronized Dispatch<Document> getDispatch() {
    if (dispatch == null) {
        Service service = Service.create(new QName(SOAPNS, "Service"));
        service.addPort(new QName(SOAPNS, "Port"), SOAPBinding.SOAP11HTTP_BINDING,
                ROOT + RPC_ROOT + apiVersion);

        dispatch = service.createDispatch(new QName(SOAPNS, "Port"), Document.class, Service.Mode.PAYLOAD);
        if (debug) {
            ((org.apache.cxf.jaxws.DispatchImpl<?>) dispatch).getClient().getEndpoint().getInInterceptors()
                    .add(new LoggingInInterceptor());
            ((org.apache.cxf.jaxws.DispatchImpl<?>) dispatch).getClient().getEndpoint().getOutInterceptors()
                    .add(new LoggingOutInterceptor());
        }//from  w w  w. ja  v a2  s.  c o m
        HTTPConduit c = (HTTPConduit) ((org.apache.cxf.jaxws.DispatchImpl<?>) dispatch).getClient()
                .getConduit();
        HTTPClientPolicy clientPol = c.getClient();
        if (clientPol == null) {
            clientPol = new HTTPClientPolicy();
        }
        //CAMEL has a couple of HUGE HUGE pages that take a long time to render
        clientPol.setReceiveTimeout(5 * 60 * 1000);
        c.setClient(clientPol);

    }
    return dispatch;
}

From source file:com.legstar.proxy.invoke.jaxws.WebServiceInvoker.java

/**
 * Creates a JAX-WS dispatcher.//  w  w  w. j a  v a 2s.  co m
 * 
 * @return an instance of jaxws dynamic client invoker.
 * @throws WebServiceInvokerException if attempt to instantiate dispatcher
 *             fails
 */
public Dispatch<Object> createDispatcher() throws WebServiceInvokerException {
    QName serviceQname = new QName(getWsdlTargetNamespace(), getWsdlServiceName());
    QName portQname = new QName(getWsdlTargetNamespace(), getWsdlPortName());
    Service service = Service.create(serviceQname);
    service.addPort(portQname, SOAPBinding.SOAP11HTTP_BINDING, getWsdlUrl());
    Dispatch<Object> dispatcher = service.createDispatch(portQname, createJAXBContext(), Service.Mode.PAYLOAD);

    if (_log.isDebugEnabled()) {
        _log.debug("New javax.xml.ws.Dispatch created for " + getWsdlServiceName());
    }
    return dispatcher;
}

From source file:edu.duke.cabig.c3pr.webservice.integration.StudyImportExportWebServiceTest.java

private Service getService() {
    Service service = Service.create(SERVICE_NAME);
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointURL.toString());
    SOAPUtils.installSecurityHandler(service);
    return service;
}

From source file:io.hummer.util.ws.WebServiceClient.java

public void changeTargetAddress(String newAddress) {
    QName portName = new QName(Configuration.NAMESPACE, "TempPort" + (getNumPorts() + 1));
    synchronized (service) {
        service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, newAddress);
    }/*from  ww  w  .j  a v  a 2s  . c o  m*/
    this.portName = portName;
}