Search in sources :

Example 6 with URL

use of org.apache.axis2.util.URL in project wso2-synapse by wso2.

the class JsonStreamBuilder method processDocument.

public OMElement processDocument(InputStream inputStream, String s, MessageContext messageContext) throws AxisFault {
    if (inputStream != null) {
        OMElement element = JsonUtil.getNewJsonPayload(messageContext, inputStream, false, false);
        if (element != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("#processDocument. Built JSON payload from JSON stream. MessageID: " + messageContext.getMessageID());
            }
            return element;
        }
    } else {
        EndpointReference endpointReference = messageContext.getTo();
        if (endpointReference == null) {
            logger.error("#processDocument. Cannot build payload without a valid EPR. MessageID: " + messageContext.getMessageID());
            throw new AxisFault("Cannot build payload without a valid EPR.");
        }
        String requestURL;
        try {
            requestURL = URIEncoderDecoder.decode(endpointReference.getAddress());
        } catch (UnsupportedEncodingException e) {
            logger.error("#processDocument. Could not decode request URL. MessageID: " + messageContext.getMessageID());
            throw new AxisFault("Could not decode request URL.", e);
        }
        String jsonString;
        int index;
        // half as the incoming JSON message
        if ((index = requestURL.indexOf('=')) > 0) {
            jsonString = requestURL.substring(index + 1);
            messageContext.setProperty(Constants.JSON_STRING, jsonString);
            ByteArrayInputStream is = new ByteArrayInputStream(jsonString.getBytes());
            return processDocument(is, s, messageContext);
        } else {
            messageContext.setProperty(Constants.JSON_STRING, null);
        }
    }
    if (logger.isDebugEnabled()) {
        logger.debug("#processDocument. No JSON payload found in request. MessageID: " + messageContext.getMessageID());
    }
    SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
    return factory.getDefaultEnvelope();
}
Also used : AxisFault(org.apache.axis2.AxisFault) OMElement(org.apache.axiom.om.OMElement) SOAPFactory(org.apache.axiom.soap.SOAPFactory) EndpointReference(org.apache.axis2.addressing.EndpointReference)

Example 7 with URL

use of org.apache.axis2.util.URL in project wso2-synapse by wso2.

the class ProxyService method buildAxisService.

/**
 * Build the underlying Axis2 service from the Proxy service definition
 *
 * @param synCfg  the Synapse configuration
 * @param axisCfg the Axis2 configuration
 * @return the Axis2 service for the Proxy
 */
public AxisService buildAxisService(SynapseConfiguration synCfg, AxisConfiguration axisCfg) {
    Parameter synapseEnv = axisCfg.getParameter(SynapseConstants.SYNAPSE_ENV);
    if (synapseEnv != null) {
        synapseEnvironment = (SynapseEnvironment) synapseEnv.getValue();
    }
    auditInfo("Building Axis service for Proxy service : " + name);
    if (pinnedServers != null && !pinnedServers.isEmpty()) {
        Parameter param = axisCfg.getParameter(SynapseConstants.SYNAPSE_ENV);
        if (param != null && param.getValue() instanceof SynapseEnvironment) {
            SynapseEnvironment synEnv = (SynapseEnvironment) param.getValue();
            String serverName = synEnv != null ? synEnv.getServerContextInformation().getServerConfigurationInformation().getServerName() : "localhost";
            if (!pinnedServers.contains(serverName)) {
                log.info("Server name " + serverName + " not in pinned servers list. " + "Not deploying Proxy service : " + name);
                return null;
            }
        }
    }
    // get the wsdlElement as an OMElement
    if (trace()) {
        trace.info("Loading the WSDL : " + (publishWSDLEndpoint != null ? " endpoint = " + publishWSDLEndpoint : (wsdlKey != null ? " key = " + wsdlKey : (wsdlURI != null ? " URI = " + wsdlURI : " <Inlined>"))));
    }
    InputStream wsdlInputStream = null;
    OMElement wsdlElement = null;
    boolean wsdlFound = false;
    String publishWSDL = null;
    SynapseEnvironment synEnv = SynapseConfigUtils.getSynapseEnvironment(axisCfg);
    String synapseHome = synEnv != null ? synEnv.getServerContextInformation().getServerConfigurationInformation().getSynapseHome() : "";
    if (wsdlKey != null) {
        synCfg.getEntryDefinition(wsdlKey);
        Object keyObject = synCfg.getEntry(wsdlKey);
        // start of fix for ESBJAVA-2641
        if (keyObject == null) {
            synCfg.removeEntry(wsdlKey);
        }
        // end of fix for ESBJAVA-2641
        if (keyObject instanceof OMElement) {
            wsdlElement = (OMElement) keyObject;
        }
        wsdlFound = true;
    } else if (inLineWSDL != null) {
        wsdlElement = (OMElement) inLineWSDL;
        wsdlFound = true;
    } else if (wsdlURI != null) {
        try {
            URL url = wsdlURI.toURL();
            publishWSDL = url.toString();
            OMNode node = SynapseConfigUtils.getOMElementFromURL(publishWSDL, synapseHome);
            if (node instanceof OMElement) {
                wsdlElement = (OMElement) node;
            }
            wsdlFound = true;
        } catch (MalformedURLException e) {
            handleException("Malformed URI for wsdl", e);
        } catch (IOException e) {
            // handleException("Error reading from wsdl URI", e);
            boolean enablePublishWSDLSafeMode = false;
            Map proxyParameters = this.getParameterMap();
            if (!proxyParameters.isEmpty()) {
                if (proxyParameters.containsKey("enablePublishWSDLSafeMode")) {
                    enablePublishWSDLSafeMode = Boolean.parseBoolean(proxyParameters.get("enablePublishWSDLSafeMode").toString().toLowerCase());
                } else {
                    if (trace()) {
                        trace.info("WSDL was unable to load for: " + publishWSDL);
                        trace.info("Please add <syn:parameter name=\"enableURISafeMode\">true" + "</syn:parameter> to proxy service.");
                    }
                    handleException("Error reading from wsdl URI", e);
                }
            }
            if (enablePublishWSDLSafeMode) {
                // !!!Need to add a reload function... And display that the wsdl/service is offline!!!
                if (trace()) {
                    trace.info("WSDL was unable to load for: " + publishWSDL);
                    trace.info("enableURISafeMode: true");
                }
                log.warn("Unable to load the WSDL for : " + name, e);
                return null;
            } else {
                if (trace()) {
                    trace.info("WSDL was unable to load for: " + publishWSDL);
                    trace.info("enableURISafeMode: false");
                }
                handleException("Error reading from wsdl URI", e);
            }
        }
    } else if (publishWSDLEndpoint != null) {
        try {
            URL url = null;
            Endpoint ep = synCfg.getEndpoint(publishWSDLEndpoint);
            if (ep == null) {
                handleException("Unable to resolve WSDL url. " + publishWSDLEndpoint + " is null");
            }
            if (ep instanceof AddressEndpoint) {
                url = new URL(((AddressEndpoint) (ep)).getDefinition().getAddress() + "?wsdl");
            } else if (ep instanceof WSDLEndpoint) {
                url = new URL(((WSDLEndpoint) (ep)).getWsdlURI());
            } else {
                handleException("Unable to resolve WSDL url. " + publishWSDLEndpoint + " is not a AddressEndpoint or WSDLEndpoint");
            }
            publishWSDL = url.toString();
            OMNode node = SynapseConfigUtils.getOMElementFromURL(publishWSDL, synapseHome);
            if (node instanceof OMElement) {
                wsdlElement = (OMElement) node;
            }
            wsdlFound = true;
        } catch (MalformedURLException e) {
            handleException("Malformed URI for wsdl", e);
        } catch (IOException e) {
            // handleException("Error reading from wsdl URI", e);
            boolean enablePublishWSDLSafeMode = false;
            Map proxyParameters = this.getParameterMap();
            if (!proxyParameters.isEmpty()) {
                if (proxyParameters.containsKey("enablePublishWSDLSafeMode")) {
                    enablePublishWSDLSafeMode = Boolean.parseBoolean(proxyParameters.get("enablePublishWSDLSafeMode").toString().toLowerCase());
                } else {
                    if (trace()) {
                        trace.info("WSDL was unable to load for: " + publishWSDL);
                        trace.info("Please add <syn:parameter name=\"enableURISafeMode\">true" + "</syn:parameter> to proxy service.");
                    }
                    handleException("Error reading from wsdl URI " + publishWSDL, e);
                }
            }
            if (enablePublishWSDLSafeMode) {
                // !!!Need to add a reload function... And display that the wsdl/service is offline!!!
                if (trace()) {
                    trace.info("WSDL was unable to load for: " + publishWSDL);
                    trace.info("enableURISafeMode: true");
                }
                log.warn("Unable to load the WSDL for : " + name, e);
                return null;
            } else {
                if (trace()) {
                    trace.info("WSDL was unable to load for: " + publishWSDL);
                    trace.info("enableURISafeMode: false");
                }
                handleException("Error reading from wsdl URI " + publishWSDL, e);
            }
        }
    } else {
        // our SynapseDispatcher will properly dispatch to
        if (trace())
            trace.info("Did not find a WSDL. Assuming a POX or Legacy service");
        axisService = new AxisService();
        AxisOperation mediateOperation = new InOutAxisOperation(SynapseConstants.SYNAPSE_OPERATION_NAME);
        // Set the names of the two messages so that Axis2 is able to produce a WSDL (see SYNAPSE-366):
        mediateOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).setName("in");
        mediateOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).setName("out");
        axisService.addOperation(mediateOperation);
    }
    // if a WSDL was found
    if (wsdlElement != null) {
        OMNamespace wsdlNamespace = wsdlElement.getNamespace();
        // if preservePolicy is set to 'false', remove the security policy content of publish wsdl
        if (preservePolicy != null && preservePolicy.equals("false")) {
            if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(wsdlNamespace.getNamespaceURI())) {
                removePolicyOfWSDL(wsdlElement);
            }
        }
        // serialize and create an input stream to read WSDL
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            if (trace())
                trace.info("Serializing wsdlElement found to build an Axis2 service");
            wsdlElement.serialize(baos);
            wsdlInputStream = new ByteArrayInputStream(baos.toByteArray());
        } catch (XMLStreamException e) {
            handleException("Error converting to a StreamSource", e);
        }
        if (wsdlInputStream != null) {
            try {
                // detect version of the WSDL 1.1 or 2.0
                if (trace())
                    trace.info("WSDL Namespace is : " + wsdlNamespace.getNamespaceURI());
                if (wsdlNamespace != null) {
                    WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
                    if (WSDL2Constants.WSDL_NAMESPACE.equals(wsdlNamespace.getNamespaceURI())) {
                        wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(wsdlInputStream, null, null);
                    } else if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(wsdlNamespace.getNamespaceURI())) {
                        wsdlToAxisServiceBuilder = new WSDL11ToAxisServiceBuilder(wsdlInputStream);
                    } else {
                        handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
                    }
                    if (wsdlToAxisServiceBuilder == null) {
                        throw new SynapseException("Could not get the WSDL to Axis Service Builder");
                    }
                    wsdlToAxisServiceBuilder.setBaseUri(wsdlURI != null ? wsdlURI.toString() : synapseHome);
                    if (trace()) {
                        trace.info("Setting up custom resolvers");
                    }
                    // load the UserDefined WSDLResolver and SchemaURIResolver implementations
                    if (synCfg.getProperty(SynapseConstants.SYNAPSE_WSDL_RESOLVER) != null && synCfg.getProperty(SynapseConstants.SYNAPSE_SCHEMA_RESOLVER) != null) {
                        setUserDefinedResourceResolvers(synCfg, wsdlInputStream, wsdlToAxisServiceBuilder);
                    } else {
                        if (resourceMap != null) {
                            // if the resource map is available use it
                            wsdlToAxisServiceBuilder.setCustomResolver(new CustomXmlSchemaURIResolver(resourceMap, synCfg));
                            // Axis 2 also needs a WSDLLocator for WSDL 1.1 documents
                            if (wsdlToAxisServiceBuilder instanceof WSDL11ToAxisServiceBuilder) {
                                ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setCustomWSDLResolver(new CustomWSDLLocator(new InputSource(wsdlInputStream), wsdlURI != null ? wsdlURI.toString() : "", resourceMap, synCfg));
                            }
                        } else {
                            // if the resource map isn't available ,
                            // then each import URIs will be resolved using base URI
                            wsdlToAxisServiceBuilder.setCustomResolver(new CustomXmlSchemaURIResolver());
                            // Axis 2 also needs a WSDLLocator for WSDL 1.1 documents
                            if (wsdlToAxisServiceBuilder instanceof WSDL11ToAxisServiceBuilder) {
                                ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setCustomWSDLResolver(new CustomWSDLLocator(new InputSource(wsdlInputStream), wsdlURI != null ? wsdlURI.toString() : ""));
                            }
                        }
                    }
                    if (trace()) {
                        trace.info("Populating Axis2 service using WSDL");
                        if (trace.isTraceEnabled()) {
                            trace.trace("WSDL : " + wsdlElement.toString());
                        }
                    }
                    axisService = wsdlToAxisServiceBuilder.populateService();
                    // this is to clear the bindings and ports already in the WSDL so that the
                    // service will generate the bindings on calling the printWSDL otherwise
                    // the WSDL which will be shown is same as the original WSDL except for the
                    // service name
                    axisService.getEndpoints().clear();
                } else {
                    handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
                }
            } catch (AxisFault af) {
                handleException("Error building service from WSDL", af);
            } catch (IOException ioe) {
                handleException("Error reading WSDL", ioe);
            }
        }
    } else if (wsdlFound) {
        handleException("Couldn't build the proxy service : " + name + ". Unable to locate the specified WSDL to build the service");
    }
    // default Service destination
    if (axisService == null) {
        throw new SynapseException("Could not create a proxy service");
    }
    axisService.setName(name);
    if (description != null) {
        axisService.setDocumentation(description);
    }
    // Setting file path for axis2 service
    if (filePath != null) {
        axisService.setFileName(filePath);
    }
    // destination
    if (transports == null || transports.size() == 0) {
    // default to all transports using service name as destination
    } else {
        if (trace())
            trace.info("Exposing transports : " + transports);
        axisService.setExposedTransports(transports);
    }
    // process parameters
    if (trace() && parameters.size() > 0) {
        trace.info("Setting service parameters : " + parameters);
    }
    for (Object o : parameters.keySet()) {
        String name = (String) o;
        Object value = parameters.get(name);
        Parameter p = new Parameter();
        p.setName(name);
        if (value instanceof String) {
            value = resolve(synapseEnvironment, (String) value);
        }
        p.setValue(value);
        try {
            axisService.addParameter(p);
        } catch (AxisFault af) {
            handleException("Error setting parameter : " + name + "" + "to proxy service as a Parameter", af);
        }
    }
    if (JavaUtils.isTrueExplicitly(axisService.getParameterValue(ABSOLUTE_SCHEMA_URL_PARAM))) {
        axisService.setCustomSchemaNamePrefix("");
    }
    if (JavaUtils.isTrueExplicitly(axisService.getParameterValue(ABSOLUTE_PROXY_SCHEMA_URL_PARAM))) {
        axisService.setCustomSchemaNamePrefix("fullschemaurl");
    }
    if (JavaUtils.isTrueExplicitly(axisService.getParameterValue("disableOperationValidation"))) {
        try {
            AxisOperation defaultOp = processOperationValidation(axisService);
        // proxyServiceGroup.setParent(axisCfg);
        } catch (AxisFault axisFault) {
        // ignore
        }
    }
    boolean isNoSecPolicy = false;
    if (!policies.isEmpty()) {
        for (PolicyInfo pi : policies) {
            String policyKey = pi.getPolicyKey();
            Policy policy = null;
            synCfg.getEntryDefinition(policyKey);
            Object policyEntry = synCfg.getEntry(policyKey);
            if (policyEntry == null) {
                handleException("Security Policy Entry not found for key: " + policyKey + " in Proxy Service: " + name);
            } else {
                policy = PolicyEngine.getPolicy(SynapseConfigUtils.getStreamSource(policyEntry).getInputStream());
            }
            if (policy == null) {
                handleException("Invalid Security Policy found for the key: " + policyKey + " in proxy service: " + name);
            }
            if (NO_SECURITY_POLICY.equals(policy.getId())) {
                isNoSecPolicy = true;
                log.info("NoSecurity Policy found, skipping policy attachment");
                continue;
            }
            if (pi.isServicePolicy()) {
                axisService.getPolicySubject().attachPolicy(policy);
            } else if (pi.isOperationPolicy()) {
                AxisOperation op = axisService.getOperation(pi.getOperation());
                if (op != null) {
                    op.getPolicySubject().attachPolicy(policy);
                } else {
                    handleException("Couldn't find the operation specified " + "by the QName : " + pi.getOperation());
                }
            } else if (pi.isMessagePolicy()) {
                if (pi.getOperation() != null) {
                    AxisOperation op = axisService.getOperation(pi.getOperation());
                    if (op != null) {
                        op.getMessage(pi.getMessageLable()).getPolicySubject().attachPolicy(policy);
                    } else {
                        handleException("Couldn't find the operation " + "specified by the QName : " + pi.getOperation());
                    }
                } else {
                    // operation is not specified and hence apply to all the applicable messages
                    for (Iterator itr = axisService.getOperations(); itr.hasNext(); ) {
                        Object obj = itr.next();
                        if (obj instanceof AxisOperation) {
                            // check whether the policy is applicable
                            if (!((obj instanceof OutOnlyAxisOperation && pi.getType() == PolicyInfo.MESSAGE_TYPE_IN) || (obj instanceof InOnlyAxisOperation && pi.getType() == PolicyInfo.MESSAGE_TYPE_OUT))) {
                                AxisMessage message = ((AxisOperation) obj).getMessage(pi.getMessageLable());
                                message.getPolicySubject().attachPolicy(policy);
                            }
                        }
                    }
                }
            } else {
                handleException("Undefined Policy type");
            }
        }
    }
    // create a custom message receiver for this proxy service
    ProxyServiceMessageReceiver msgRcvr = new ProxyServiceMessageReceiver();
    msgRcvr.setName(name);
    msgRcvr.setProxy(this);
    Iterator iter = axisService.getOperations();
    while (iter.hasNext()) {
        AxisOperation op = (AxisOperation) iter.next();
        op.setMessageReceiver(msgRcvr);
    }
    try {
        axisService.addParameter(SynapseConstants.SERVICE_TYPE_PARAM_NAME, SynapseConstants.PROXY_SERVICE_TYPE);
        if (serviceGroup == null) {
            auditInfo("Adding service " + name + " to the Axis2 configuration");
            axisCfg.addService(axisService);
        } else {
            auditInfo("Adding service " + name + " to the service group " + serviceGroup);
            if (axisCfg.getServiceGroup(serviceGroup) == null) {
                // If the specified group does not exist we should create it
                AxisServiceGroup proxyServiceGroup = new AxisServiceGroup();
                proxyServiceGroup.setServiceGroupName(serviceGroup);
                proxyServiceGroup.setParent(axisCfg);
                // Add  the service to the new group and add the group the AxisConfiguration
                proxyServiceGroup.addService(axisService);
                axisCfg.addServiceGroup(proxyServiceGroup);
            } else {
                // Simply add the service to the existing group
                axisService.setParent(axisCfg.getServiceGroup(serviceGroup));
                axisCfg.addServiceToExistingServiceGroup(axisService, serviceGroup);
            }
        }
        this.setRunning(true);
    } catch (AxisFault axisFault) {
        try {
            if (axisCfg.getService(axisService.getName()) != null) {
                if (trace())
                    trace.info("Removing service " + name + " due to error : " + axisFault.getMessage());
                axisCfg.removeService(axisService.getName());
            }
        } catch (AxisFault ignore) {
        }
        handleException("Error adding Proxy service to the Axis2 engine", axisFault);
    }
    // should Addressing be engaged on this service?
    if (wsAddrEnabled) {
        auditInfo("WS-Addressing is enabled for service : " + name);
        try {
            axisService.engageModule(axisCfg.getModule(SynapseConstants.ADDRESSING_MODULE_NAME), axisCfg);
        } catch (AxisFault axisFault) {
            handleException("Error loading WS Addressing module on proxy service : " + name, axisFault);
        }
    }
    // should Security be engaged on this service?
    boolean secModuleEngaged = false;
    if (wsSecEnabled && !isNoSecPolicy) {
        auditInfo("WS-Security is enabled for service : " + name);
        try {
            axisService.engageModule(axisCfg.getModule(SynapseConstants.SECURITY_MODULE_NAME), axisCfg);
            secModuleEngaged = true;
        } catch (AxisFault axisFault) {
            handleException("Error loading WS Sec module on proxy service : " + name, axisFault);
        }
    } else if (isNoSecPolicy) {
        log.info("NoSecurity Policy found, skipping rampart engagement");
    }
    moduleEngaged = secModuleEngaged || wsAddrEnabled;
    wsdlPublished = wsdlFound;
    // Engaging Axis2 modules
    Object engaged_modules = parameters.get(ENGAGED_MODULES);
    if (engaged_modules != null) {
        String[] moduleNames = getModuleNames((String) engaged_modules);
        if (moduleNames != null) {
            for (String moduleName : moduleNames) {
                try {
                    AxisModule axisModule = axisCfg.getModule(moduleName);
                    if (axisModule != null) {
                        axisService.engageModule(axisModule, axisCfg);
                        moduleEngaged = true;
                    }
                } catch (AxisFault axisFault) {
                    handleException("Error loading " + moduleName + " module on proxy service : " + name, axisFault);
                }
            }
        }
    }
    auditInfo("Successfully created the Axis2 service for Proxy service : " + name);
    return axisService;
}
Also used : AxisFault(org.apache.axis2.AxisFault) Policy(org.apache.neethi.Policy) MalformedURLException(java.net.MalformedURLException) InputSource(org.xml.sax.InputSource) SynapseException(org.apache.synapse.SynapseException) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) OMElement(org.apache.axiom.om.OMElement) URL(java.net.URL) Endpoint(org.apache.synapse.endpoints.Endpoint) WSDLEndpoint(org.apache.synapse.endpoints.WSDLEndpoint) AddressEndpoint(org.apache.synapse.endpoints.AddressEndpoint) WSDLEndpoint(org.apache.synapse.endpoints.WSDLEndpoint) CustomXmlSchemaURIResolver(org.apache.synapse.util.resolver.CustomXmlSchemaURIResolver) OMNamespace(org.apache.axiom.om.OMNamespace) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) PolicyInfo(org.apache.synapse.util.PolicyInfo) IOException(java.io.IOException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OMNode(org.apache.axiom.om.OMNode) AddressEndpoint(org.apache.synapse.endpoints.AddressEndpoint) XMLStreamException(javax.xml.stream.XMLStreamException) ByteArrayInputStream(java.io.ByteArrayInputStream) CustomWSDLLocator(org.apache.synapse.util.resolver.CustomWSDLLocator) ResourceMap(org.apache.synapse.util.resolver.ResourceMap)

Example 8 with URL

use of org.apache.axis2.util.URL in project wso2-synapse by wso2.

the class BlockingMsgSender method send.

/**
 * Blocking Invocation
 *
 * @param endpointDefinition the endpoint being sent to.
 * @param synapseInMsgCtx the outgoing synapse message.
 * @throws AxisFault on errors.
 */
public void send(EndpointDefinition endpointDefinition, MessageContext synapseInMsgCtx) throws AxisFault {
    if (log.isDebugEnabled()) {
        log.debug("Start Sending the Message ");
    }
    org.apache.axis2.context.MessageContext axisInMsgCtx = ((Axis2MessageContext) synapseInMsgCtx).getAxis2MessageContext();
    org.apache.axis2.context.MessageContext axisOutMsgCtx = new org.apache.axis2.context.MessageContext();
    String endpointReferenceValue = null;
    if (endpointDefinition.getAddress() != null) {
        endpointReferenceValue = endpointDefinition.getAddress();
    } else if (axisInMsgCtx.getTo() != null) {
        endpointReferenceValue = axisInMsgCtx.getTo().getAddress();
    } else {
        handleException("Service url, Endpoint or 'To' header is required");
    }
    EndpointReference epr = new EndpointReference(endpointReferenceValue);
    axisOutMsgCtx.setTo(epr);
    AxisService anonymousService;
    if (endpointReferenceValue != null && endpointReferenceValue.startsWith(Constants.TRANSPORT_LOCAL)) {
        configurationContext = axisInMsgCtx.getConfigurationContext();
        anonymousService = AnonymousServiceFactory.getAnonymousService(configurationContext.getAxisConfiguration(), LOCAL_ANON_SERVICE);
    } else {
        anonymousService = AnonymousServiceFactory.getAnonymousService(null, configurationContext.getAxisConfiguration(), endpointDefinition.isAddressingOn() | endpointDefinition.isReliableMessagingOn(), endpointDefinition.isReliableMessagingOn(), endpointDefinition.isSecurityOn(), false);
    }
    axisOutMsgCtx.setConfigurationContext(configurationContext);
    axisOutMsgCtx.setEnvelope(axisInMsgCtx.getEnvelope());
    axisOutMsgCtx.setProperty(HTTPConstants.NON_ERROR_HTTP_STATUS_CODES, axisInMsgCtx.getProperty(HTTPConstants.NON_ERROR_HTTP_STATUS_CODES));
    axisOutMsgCtx.setProperty(HTTPConstants.ERROR_HTTP_STATUS_CODES, axisInMsgCtx.getProperty(HTTPConstants.ERROR_HTTP_STATUS_CODES));
    axisOutMsgCtx.setProperty(SynapseConstants.DISABLE_CHUNKING, axisInMsgCtx.getProperty(SynapseConstants.DISABLE_CHUNKING));
    axisOutMsgCtx.setProperty(SynapseConstants.NO_KEEPALIVE, axisInMsgCtx.getProperty(SynapseConstants.NO_KEEPALIVE));
    axisOutMsgCtx.setProperty(SynapseConstants.NO_DEFAULT_CONTENT_TYPE, axisInMsgCtx.getProperty(SynapseConstants.NO_DEFAULT_CONTENT_TYPE));
    // Fill MessageContext
    BlockingMsgSenderUtils.fillMessageContext(endpointDefinition, axisOutMsgCtx, synapseInMsgCtx);
    if (JsonUtil.hasAJsonPayload(axisInMsgCtx)) {
        JsonUtil.cloneJsonPayload(axisInMsgCtx, axisOutMsgCtx);
    }
    Options clientOptions;
    if (initClientOptions) {
        clientOptions = new Options();
    } else {
        clientOptions = axisInMsgCtx.getOptions();
        clientOptions.setTo(epr);
    }
    // Fill Client options
    BlockingMsgSenderUtils.fillClientOptions(endpointDefinition, clientOptions, synapseInMsgCtx);
    // Update To url if mock-service exists for unit test
    MediatorPropertyUtils.updateSendToUrlForMockServices(endpointDefinition, synapseInMsgCtx, axisOutMsgCtx);
    anonymousService.getParent().addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true");
    ServiceGroupContext serviceGroupContext = new ServiceGroupContext(configurationContext, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = serviceGroupContext.getServiceContext(anonymousService);
    axisOutMsgCtx.setServiceContext(serviceCtx);
    // Invoke
    boolean isOutOnly = isOutOnly(synapseInMsgCtx, axisOutMsgCtx);
    try {
        if (isOutOnly) {
            sendRobust(axisOutMsgCtx, clientOptions, anonymousService, serviceCtx, synapseInMsgCtx);
            final String httpStatusCode = String.valueOf(axisOutMsgCtx.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE)).trim();
            /*
                 * Though this is OUT_ONLY operation, we need to set the
                 * response Status code so that others can make use of it.
                 */
            axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, httpStatusCode);
            synapseInMsgCtx.setProperty(SynapseConstants.BLOCKING_SENDER_ERROR, "false");
        } else {
            org.apache.axis2.context.MessageContext result = sendReceive(axisOutMsgCtx, clientOptions, anonymousService, serviceCtx, synapseInMsgCtx);
            synapseInMsgCtx.setEnvelope(result.getEnvelope());
            if (JsonUtil.hasAJsonPayload(result)) {
                JsonUtil.cloneJsonPayload(result, ((Axis2MessageContext) synapseInMsgCtx).getAxis2MessageContext());
            }
            final String statusCode = String.valueOf(result.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE)).trim();
            /*
                 * We need to set the response status code so that users can
                 * fetch it later.
                 */
            axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, statusCode);
            if ("false".equals(synapseInMsgCtx.getProperty(SynapseConstants.BLOCKING_SENDER_PRESERVE_REQ_HEADERS))) {
                axisInMsgCtx.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, result.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
            }
            synapseInMsgCtx.setProperty(SynapseConstants.BLOCKING_SENDER_ERROR, "false");
            this.invokeHandlers(synapseInMsgCtx);
        }
    } catch (Exception ex) {
        /*
             * Extract the HTTP status code from the Exception message.
             */
        final String errorStatusCode = extractStatusCodeFromException(ex);
        axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, errorStatusCode);
        synapseInMsgCtx.setProperty(SynapseConstants.BLOCKING_SENDER_ERROR, "true");
        synapseInMsgCtx.setProperty(SynapseConstants.ERROR_EXCEPTION, ex);
        if (ex instanceof AxisFault) {
            AxisFault fault = (AxisFault) ex;
            int errorCode = SynapseConstants.BLOCKING_SENDER_OPERATION_FAILED;
            if (fault.getFaultCode() != null && fault.getFaultCode().getLocalPart() != null && !"".equals(fault.getFaultCode().getLocalPart())) {
                try {
                    errorCode = Integer.parseInt(fault.getFaultCode().getLocalPart());
                } catch (NumberFormatException e) {
                    errorCode = SynapseConstants.BLOCKING_SENDER_OPERATION_FAILED;
                }
            }
            synapseInMsgCtx.setProperty(SynapseConstants.ERROR_CODE, errorCode);
            synapseInMsgCtx.setProperty(SynapseConstants.ERROR_MESSAGE, fault.getMessage());
            synapseInMsgCtx.setProperty(SynapseConstants.ERROR_DETAIL, fault.getDetail() != null ? fault.getDetail().getText() : "");
            if (!isOutOnly) {
                org.apache.axis2.context.MessageContext faultMC = fault.getFaultMessageContext();
                if (faultMC != null) {
                    Object statusCode = faultMC.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE);
                    synapseInMsgCtx.setProperty(SynapseConstants.HTTP_SC, statusCode);
                    axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, statusCode);
                    synapseInMsgCtx.setEnvelope(faultMC.getEnvelope());
                }
            }
        }
    }
    // get the original message context that went through the OAuth Configured HTTP endpoint
    // this is used to retry the call when there is any oauth related issue
    org.apache.synapse.MessageContext originalMC = MessageCache.getInstance().removeMessageContext(synapseInMsgCtx.getMessageID());
    // Check fault occure when send the request to endpoint
    if ("true".equals(synapseInMsgCtx.getProperty(SynapseConstants.BLOCKING_SENDER_ERROR))) {
        // Handle the fault
        synapseInMsgCtx.getFaultStack().pop().handleFault(synapseInMsgCtx, (Exception) synapseInMsgCtx.getProperty(SynapseConstants.ERROR_EXCEPTION));
    } else {
        // If a message was successfully processed to give it a chance to clear up or reset its state to active
        Stack<FaultHandler> faultStack = synapseInMsgCtx.getFaultStack();
        if (faultStack != null && !faultStack.isEmpty()) {
            AbstractEndpoint successfulEndpoint = null;
            if (faultStack.peek() instanceof AbstractEndpoint) {
                successfulEndpoint = (AbstractEndpoint) faultStack.pop();
                successfulEndpoint.onSuccess();
            }
            if (successfulEndpoint instanceof OAuthConfiguredHTTPEndpoint) {
                OAuthConfiguredHTTPEndpoint httpEndpoint = (OAuthConfiguredHTTPEndpoint) successfulEndpoint;
                if (originalMC != null && OAuthUtils.retryOnOAuthFailure(httpEndpoint, synapseInMsgCtx, synapseInMsgCtx)) {
                    MessageContext messageContext = httpEndpoint.retryCallWithNewToken(originalMC);
                    ((Axis2MessageContext) synapseInMsgCtx).setAxis2MessageContext(((Axis2MessageContext) messageContext).getAxis2MessageContext());
                }
            }
            // Remove all endpoint related fault handlers if any
            while (!faultStack.empty() && faultStack.peek() instanceof AbstractEndpoint) {
                faultStack.pop();
            }
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) Options(org.apache.axis2.client.Options) AbstractEndpoint(org.apache.synapse.endpoints.AbstractEndpoint) ServiceContext(org.apache.axis2.context.ServiceContext) AxisService(org.apache.axis2.description.AxisService) OAuthConfiguredHTTPEndpoint(org.apache.synapse.endpoints.OAuthConfiguredHTTPEndpoint) SynapseException(org.apache.synapse.SynapseException) EndpointReference(org.apache.axis2.addressing.EndpointReference) ServiceGroupContext(org.apache.axis2.context.ServiceGroupContext) MessageContext(org.apache.synapse.MessageContext) Axis2MessageContext(org.apache.synapse.core.axis2.Axis2MessageContext) MessageContext(org.apache.synapse.MessageContext) FaultHandler(org.apache.synapse.FaultHandler) Axis2MessageContext(org.apache.synapse.core.axis2.Axis2MessageContext)

Example 9 with URL

use of org.apache.axis2.util.URL in project wso2-synapse by wso2.

the class BlockingMsgSender method send.

public MessageContext send(Endpoint endpoint, MessageContext synapseInMsgCtx) throws Exception {
    if (log.isDebugEnabled()) {
        log.debug("Start Sending the Message ");
    }
    if (endpoint instanceof IndirectEndpoint) {
        String endpointKey = ((IndirectEndpoint) endpoint).getKey();
        endpoint = synapseInMsgCtx.getEndpoint(endpointKey);
    }
    if (endpoint instanceof TemplateEndpoint) {
        endpoint = ((TemplateEndpoint) endpoint).getRealEndpoint();
    }
    // get the correct endpoint definition
    if (endpoint instanceof ResolvingEndpoint) {
        SynapseXPath keyExpression = ((ResolvingEndpoint) endpoint).getKeyExpression();
        String key = keyExpression.stringValueOf(synapseInMsgCtx);
        endpoint = ((ResolvingEndpoint) endpoint).loadAndInitEndpoint(((Axis2MessageContext) synapseInMsgCtx).getAxis2MessageContext().getConfigurationContext(), key);
    }
    AbstractEndpoint abstractEndpoint = (AbstractEndpoint) endpoint;
    if (!abstractEndpoint.isLeafEndpoint()) {
        handleException("Endpoint Type not supported");
    }
    // clear the message context properties related to endpoint in last service invocation
    Set keySet = synapseInMsgCtx.getPropertyKeySet();
    if (keySet != null) {
        keySet.remove(EndpointDefinition.DYNAMIC_URL_VALUE);
    }
    abstractEndpoint.executeEpTypeSpecificFunctions(synapseInMsgCtx);
    EndpointDefinition endpointDefinition = abstractEndpoint.getDefinition();
    org.apache.axis2.context.MessageContext axisInMsgCtx = ((Axis2MessageContext) synapseInMsgCtx).getAxis2MessageContext();
    org.apache.axis2.context.MessageContext axisOutMsgCtx = new org.apache.axis2.context.MessageContext();
    String endpointReferenceValue = null;
    if (endpointDefinition.getAddress() != null) {
        endpointReferenceValue = endpointDefinition.getAddress();
    } else if (axisInMsgCtx.getTo() != null) {
        endpointReferenceValue = axisInMsgCtx.getTo().getAddress();
    } else {
        handleException("Service url, Endpoint or 'To' header is required");
    }
    EndpointReference epr = new EndpointReference(endpointReferenceValue);
    axisOutMsgCtx.setTo(epr);
    AxisService anonymousService;
    if (endpointReferenceValue != null && endpointReferenceValue.startsWith(Constants.TRANSPORT_LOCAL)) {
        configurationContext = axisInMsgCtx.getConfigurationContext();
        anonymousService = AnonymousServiceFactory.getAnonymousService(configurationContext.getAxisConfiguration(), LOCAL_ANON_SERVICE);
    } else {
        anonymousService = AnonymousServiceFactory.getAnonymousService(null, configurationContext.getAxisConfiguration(), endpointDefinition.isAddressingOn() | endpointDefinition.isReliableMessagingOn(), endpointDefinition.isReliableMessagingOn(), endpointDefinition.isSecurityOn(), false);
    }
    axisOutMsgCtx.setConfigurationContext(configurationContext);
    axisOutMsgCtx.setEnvelope(axisInMsgCtx.getEnvelope());
    axisOutMsgCtx.setProperty(HTTPConstants.NON_ERROR_HTTP_STATUS_CODES, axisInMsgCtx.getProperty(HTTPConstants.NON_ERROR_HTTP_STATUS_CODES));
    axisOutMsgCtx.setProperty(HTTPConstants.ERROR_HTTP_STATUS_CODES, axisInMsgCtx.getProperty(HTTPConstants.ERROR_HTTP_STATUS_CODES));
    axisOutMsgCtx.setProperty(SynapseConstants.DISABLE_CHUNKING, axisInMsgCtx.getProperty(SynapseConstants.DISABLE_CHUNKING));
    axisOutMsgCtx.setProperty(SynapseConstants.NO_KEEPALIVE, axisInMsgCtx.getProperty(SynapseConstants.NO_KEEPALIVE));
    // Can't refer to the Axis2 constant 'NO_DEFAULT_CONTENT_TYPE' defined in 1.6.1.wso2v23-SNAPSHOT until
    // an API change is done.
    axisOutMsgCtx.setProperty(SynapseConstants.NO_DEFAULT_CONTENT_TYPE, axisInMsgCtx.getProperty(SynapseConstants.NO_DEFAULT_CONTENT_TYPE));
    // Fill MessageContext
    BlockingMsgSenderUtils.fillMessageContext(endpointDefinition, axisOutMsgCtx, synapseInMsgCtx);
    if (JsonUtil.hasAJsonPayload(axisInMsgCtx)) {
        JsonUtil.cloneJsonPayload(axisInMsgCtx, axisOutMsgCtx);
    }
    Options clientOptions;
    if (initClientOptions) {
        clientOptions = new Options();
    } else {
        clientOptions = axisInMsgCtx.getOptions();
        clientOptions.setTo(epr);
    }
    // Fill Client options
    BlockingMsgSenderUtils.fillClientOptions(endpointDefinition, clientOptions, synapseInMsgCtx);
    anonymousService.getParent().addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true");
    ServiceGroupContext serviceGroupContext = new ServiceGroupContext(configurationContext, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = serviceGroupContext.getServiceContext(anonymousService);
    axisOutMsgCtx.setServiceContext(serviceCtx);
    // Invoke
    boolean isOutOnly = isOutOnly(synapseInMsgCtx, axisOutMsgCtx);
    try {
        if (isOutOnly) {
            sendRobust(axisOutMsgCtx, clientOptions, anonymousService, serviceCtx, synapseInMsgCtx);
            final String httpStatusCode = String.valueOf(axisOutMsgCtx.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE)).trim();
            /*
                 * Though this is OUT_ONLY operation, we need to set the
                 * response Status code so that others can make use of it.
                 */
            axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, httpStatusCode);
        } else {
            org.apache.axis2.context.MessageContext result = sendReceive(axisOutMsgCtx, clientOptions, anonymousService, serviceCtx, synapseInMsgCtx);
            if (result.getEnvelope() != null) {
                synapseInMsgCtx.setEnvelope(result.getEnvelope());
                if (JsonUtil.hasAJsonPayload(result)) {
                    JsonUtil.cloneJsonPayload(result, ((Axis2MessageContext) synapseInMsgCtx).getAxis2MessageContext());
                }
            }
            final String statusCode = String.valueOf(result.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE)).trim();
            /*
                 * We need to set the response status code so that users can
                 * fetch it later.
                 */
            axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, statusCode);
            if ("false".equals(synapseInMsgCtx.getProperty(SynapseConstants.BLOCKING_SENDER_PRESERVE_REQ_HEADERS))) {
                axisInMsgCtx.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, result.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
            }
            synapseInMsgCtx.setProperty(SynapseConstants.BLOCKING_SENDER_ERROR, "false");
            this.invokeHandlers(synapseInMsgCtx);
            return synapseInMsgCtx;
        }
    } catch (Exception ex) {
        /*
             * Extract the HTTP status code from the Exception message.
             */
        final String errorStatusCode = extractStatusCodeFromException(ex);
        axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, errorStatusCode);
        if (!isOutOnly) {
            // axisOutMsgCtx.getTransportOut().getSender().cleanup(axisOutMsgCtx);
            synapseInMsgCtx.setProperty(SynapseConstants.BLOCKING_SENDER_ERROR, "true");
            synapseInMsgCtx.setProperty(SynapseConstants.ERROR_EXCEPTION, ex);
            if (ex instanceof AxisFault) {
                AxisFault fault = (AxisFault) ex;
                setErrorDetails(synapseInMsgCtx, fault);
                org.apache.axis2.context.MessageContext faultMC = fault.getFaultMessageContext();
                if (faultMC != null) {
                    Object statusCode = faultMC.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE);
                    synapseInMsgCtx.setProperty(SynapseConstants.HTTP_SC, statusCode);
                    axisInMsgCtx.setProperty(SynapseConstants.HTTP_SC, statusCode);
                    synapseInMsgCtx.setEnvelope(faultMC.getEnvelope());
                }
            }
            return synapseInMsgCtx;
        } else {
            if (ex instanceof AxisFault) {
                AxisFault fault = (AxisFault) ex;
                setErrorDetails(synapseInMsgCtx, fault);
            }
        }
        handleException("Error sending Message to url : " + ((AbstractEndpoint) endpoint).getDefinition().getAddress(), ex);
    }
    return null;
}
Also used : AxisFault(org.apache.axis2.AxisFault) ResolvingEndpoint(org.apache.synapse.endpoints.ResolvingEndpoint) SynapseXPath(org.apache.synapse.util.xpath.SynapseXPath) AbstractEndpoint(org.apache.synapse.endpoints.AbstractEndpoint) Options(org.apache.axis2.client.Options) IndirectEndpoint(org.apache.synapse.endpoints.IndirectEndpoint) Set(java.util.Set) ServiceContext(org.apache.axis2.context.ServiceContext) AxisService(org.apache.axis2.description.AxisService) EndpointDefinition(org.apache.synapse.endpoints.EndpointDefinition) SynapseException(org.apache.synapse.SynapseException) EndpointReference(org.apache.axis2.addressing.EndpointReference) ServiceGroupContext(org.apache.axis2.context.ServiceGroupContext) MessageContext(org.apache.synapse.MessageContext) Axis2MessageContext(org.apache.synapse.core.axis2.Axis2MessageContext) TemplateEndpoint(org.apache.synapse.endpoints.TemplateEndpoint) Axis2MessageContext(org.apache.synapse.core.axis2.Axis2MessageContext)

Example 10 with URL

use of org.apache.axis2.util.URL in project wso2-synapse by wso2.

the class APIDeployerTest method testUpdate.

/**
 * Test updating an API
 *
 * @throws Exception
 */
@Test
public void testUpdate() throws Exception {
    String inputXML = "<api name=\"TestAPI\" context=\"/order\" xmlns=\"http://ws.apache.org/ns/synapse\">" + "<resource url-mapping=\"/list\" inSequence=\"seq1\" outSequence=\"seq2\" xmlns=\"http://ws.apache.org/ns/synapse\"/>" + "</api>";
    OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
    APIDeployer apiDeployer = new APIDeployer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
    SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
    cfgCtx.setAxisConfiguration(axisConfiguration);
    apiDeployer.init(cfgCtx);
    apiDeployer.deploySynapseArtifact(inputElement, "sampleFile", new Properties());
    String inputUpdatedXML = "<api name=\"TestAPIUpdated\" context=\"/orderUpdated\" xmlns=\"http://ws.apache.org/ns/synapse\">" + "<resource url-mapping=\"/list\" inSequence=\"seq1\" outSequence=\"seq2\" xmlns=\"http://ws.apache.org/ns/synapse\"/>" + "</api>";
    OMElement inputUpdatedElement = AXIOMUtil.stringToOM(inputUpdatedXML);
    String response = apiDeployer.updateSynapseArtifact(inputUpdatedElement, "sampleUpdatedFile", "TestAPI", new Properties());
    Assert.assertEquals("API not updated!", "TestAPIUpdated", response);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)31 EndpointReference (org.apache.axis2.addressing.EndpointReference)29 AxisFault (org.apache.axis2.AxisFault)27 URL (java.net.URL)21 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)19 URL (org.apache.axis2.util.URL)19 HttpClient (org.apache.http.client.HttpClient)19 Options (org.apache.axis2.client.Options)18 MalformedURLException (java.net.MalformedURLException)17 OMElement (org.apache.axiom.om.OMElement)17 MessageContext (org.apache.axis2.context.MessageContext)16 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)16 ServiceClient (org.apache.axis2.client.ServiceClient)13 SynapseException (org.apache.synapse.SynapseException)13 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)12 AxisService (org.apache.axis2.description.AxisService)10 StringEntity (org.apache.http.entity.StringEntity)9 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)9 Map (java.util.Map)7 JSONObject (org.json.JSONObject)7