Search in sources :

Example 1 with AxisBinding

use of org.apache.axis2.description.AxisBinding in project wso2-synapse by wso2.

the class XFormURLEncodedBuilder method getSOAPFactory.

private SOAPFactory getSOAPFactory(MessageContext messageContext) throws AxisFault {
    SOAPFactory soapFactory;
    AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
    if (axisEndpoint != null) {
        AxisBinding axisBinding = axisEndpoint.getBinding();
        String soapVersion = (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
        soapFactory = getSOAPFactory(soapVersion);
    } else {
        soapFactory = getSOAPFactory(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    }
    return soapFactory;
}
Also used : AxisBinding(org.apache.axis2.description.AxisBinding) AxisEndpoint(org.apache.axis2.description.AxisEndpoint) SOAPFactory(org.apache.axiom.soap.SOAPFactory)

Example 2 with AxisBinding

use of org.apache.axis2.description.AxisBinding in project wso2-synapse by wso2.

the class XFormURLEncodedBuilder method processDocumentWrapper.

/**
 * @return Returns the document element.
 */
private OMElement processDocumentWrapper(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault {
    MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();
    SOAPFactory soapFactory;
    AxisBindingOperation axisBindingOperation = (AxisBindingOperation) messageContext.getProperty(Constants.AXIS_BINDING_OPERATION);
    String queryParameterSeparator = null;
    String templatedPath = null;
    if (axisBindingOperation != null) {
        queryParameterSeparator = (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR);
        templatedPath = (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION);
    }
    if (queryParameterSeparator == null) {
        queryParameterSeparator = WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT;
    }
    AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
    if (axisEndpoint != null) {
        AxisBinding axisBinding = axisEndpoint.getBinding();
        String soapVersion = (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
        soapFactory = getSOAPFactory(soapVersion);
    } else {
        soapFactory = getSOAPFactory(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    }
    EndpointReference endpointReference = messageContext.getTo();
    if (endpointReference == null) {
        throw new AxisFault("Cannot create DocumentElement without destination EPR");
    }
    String requestURL = endpointReference.getAddress();
    try {
        requestURL = extractParametersUsingHttpLocation(templatedPath, parameterMap, requestURL, queryParameterSeparator);
    } catch (UnsupportedEncodingException e) {
        throw AxisFault.makeFault(e);
    }
    String query = requestURL;
    int index;
    if ((index = requestURL.indexOf("?")) > -1) {
        query = requestURL.substring(index + 1);
    }
    extractParametersFromRequest(parameterMap, query, queryParameterSeparator, (String) messageContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING), inputStream);
    messageContext.setProperty(Constants.REQUEST_PARAMETER_MAP, parameterMap);
    return BuilderUtil.buildsoapMessage(messageContext, parameterMap, soapFactory);
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisBinding(org.apache.axis2.description.AxisBinding) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MultipleEntryHashMap(org.apache.axis2.util.MultipleEntryHashMap) AxisBindingOperation(org.apache.axis2.description.AxisBindingOperation) AxisEndpoint(org.apache.axis2.description.AxisEndpoint) SOAPFactory(org.apache.axiom.soap.SOAPFactory) AxisEndpoint(org.apache.axis2.description.AxisEndpoint) EndpointReference(org.apache.axis2.addressing.EndpointReference)

Example 3 with AxisBinding

use of org.apache.axis2.description.AxisBinding in project carbon-business-process by wso2.

the class BPELMessageContextFactory method extractBindingInformation.

private static Binding extractBindingInformation(final AxisService service, final Definition wsdlOfService, final MessageContext inMessageContext) {
    AxisEndpoint currentEndpoint = (AxisEndpoint) inMessageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
    if (currentEndpoint == null) {
        String defaultEndpointName = service.getEndpointName();
        currentEndpoint = service.getEndpoints().get(defaultEndpointName);
        if (currentEndpoint == null) {
            throw new NullPointerException("AxisEndpoint cannot be null.");
        }
    }
    AxisBinding currentAxisBinding = currentEndpoint.getBinding();
    QName bindingQName = currentAxisBinding.getName();
    return wsdlOfService.getBinding(bindingQName);
}
Also used : QName(javax.xml.namespace.QName) AxisBinding(org.apache.axis2.description.AxisBinding) AxisEndpoint(org.apache.axis2.description.AxisEndpoint)

Aggregations

AxisBinding (org.apache.axis2.description.AxisBinding)3 AxisEndpoint (org.apache.axis2.description.AxisEndpoint)3 SOAPFactory (org.apache.axiom.soap.SOAPFactory)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 QName (javax.xml.namespace.QName)1 AxisFault (org.apache.axis2.AxisFault)1 EndpointReference (org.apache.axis2.addressing.EndpointReference)1 AxisBindingOperation (org.apache.axis2.description.AxisBindingOperation)1 MultipleEntryHashMap (org.apache.axis2.util.MultipleEntryHashMap)1