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

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

Introduction

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

Prototype

String SOAP12HTTP_BINDING

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

Click Source Link

Document

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

Usage

From source file:org.wso2.carbon.connector.rm.ReliableMessage.java

/**
 * This method used to create dispatcher
 *
 * @param inputParams input parameters./*from   w w  w .jav  a2 s.  c o m*/
 * @return Dispatch source dispatcher
 * @throws ConnectException
 */
private Dispatch<Source> createDispatch(RMParameters inputParams, MessageContext messageContext)
        throws ConnectException {
    String portName = inputParams.getPortName();
    String serviceName = inputParams.getServiceName();
    String nameSpace = inputParams.getNamespace();

    QName serviceQName = new QName(nameSpace, serviceName);
    QName portQName = new QName(nameSpace, portName);
    Service service = Service.create(serviceQName);

    if (service == null) {
        String message = "Service instance cannot initialize";
        log.error(message);
        throw new ConnectException(message);
    }

    if (RMConstants.SOAP_V_11.equals(inputParams.getSoapVersion())) {
        service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, inputParams.getEndpoint());
    } else {
        service.addPort(portQName, SOAPBinding.SOAP12HTTP_BINDING, inputParams.getEndpoint());
    }

    Dispatch<Source> sourceDispatch = service.createDispatch(portQName, Source.class, Service.Mode.MESSAGE);
    if (messageContext.getSoapAction() != null && !messageContext.getSoapAction().isEmpty()) {
        sourceDispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
                messageContext.getSoapAction());
    }
    return sourceDispatch;
}