Search in sources :

Example 1 with AxisEndpoint

use of org.apache.axis2.description.AxisEndpoint 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 AxisEndpoint

use of org.apache.axis2.description.AxisEndpoint 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 AxisEndpoint

use of org.apache.axis2.description.AxisEndpoint 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)

Example 4 with AxisEndpoint

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

the class RESTUtil method dispatchAndVerify.

public static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
    String extendedURIBasedDispatcher = System.getProperty("ei.extendedURIBasedDispatcher");
    if (extendedURIBasedDispatcher == null) {
        requestDispatcher.invoke(msgContext);
    } else {
        try {
            invokeMethod.invoke(dispatcherInstance, msgContext);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new AxisFault(e.getMessage());
        }
    }
    AxisService axisService = msgContext.getAxisService();
    if (axisService != null) {
        httpLocationBasedDispatcher.invoke(msgContext);
        if (msgContext.getAxisOperation() == null) {
            requestURIOperationDispatcher.invoke(msgContext);
        }
        AxisOperation axisOperation;
        if ((axisOperation = msgContext.getAxisOperation()) != null) {
            AxisEndpoint axisEndpoint = (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
            if (axisEndpoint != null) {
                AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint.getBinding().getChild(axisOperation.getName());
                msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
            }
            msgContext.setAxisOperation(axisOperation);
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisOperation(org.apache.axis2.description.AxisOperation) AxisService(org.apache.axis2.description.AxisService) AxisBindingOperation(org.apache.axis2.description.AxisBindingOperation) AxisEndpoint(org.apache.axis2.description.AxisEndpoint) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

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