简体   繁体   中英

WSO2 API Manager Tool: Unable to convert JSONtoSOAP and then SOAPtoJSON to communicate between mock backend and API

Following the guidelines from WSO2 Documentation at: https://docs.wso2.com/display/AM260/Convert+a+JSON+Message+to+SOAP+and+SOAP+to+JSON

The intended response was

I revised it a couple times but keep getting "400: bad request error"

my curl and the error

EDIT¹: After running tests I found out that the issue is just with the SOAPtoJSON conversion. When I POST without the OUT (SOAPtoJSON) sequence, I get the XML answer exactly as intended as shown here

Thats my JSONtoSOAP.xml:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="JSONtoSOAP" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <payloadFactory media-type="xml">
        <format>
            <soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <soap12:Body>
                    <CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
                        <PhoneNumber>$1</PhoneNumber>
                        <LicenseKey>$2</LicenseKey>
                    </CheckPhoneNumber>
                </soap12:Body>
            </soap12:Envelope>
        </format>
        <args>
            <arg evaluator="xml" expression="//request/PhoneNumber" literal="true"/>
            <arg evaluator="xml" expression="//request/LicenseKey" literal="true"/>
        </args>
    </payloadFactory>
    <property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
</sequence>

Thats my SOAPtoJSON.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<sequence name="SOAPtoJSON" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <log level="custom" separator=",">
        <property name="TRACE" value="Global Mediation Extension"/>
    </log>
    <payloadFactory media-type="xml">
        <format>
            <CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
                <PhoneNumber>$1</PhoneNumber>
                <LicenseKey>$2</LicenseKey>
            </CheckPhoneNumber>
        </format>
        <args>
            <arg evaluator="xml" expression="//request/PhoneNumber"/>
            <arg evaluator="xml" expression="//request/LicenseKey"/>
        </args>
    </payloadFactory>
    <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
</sequence>

I'm really new to the technology. And I just followed the steps from the documentation as mentioned. Maybe is was just a silly mistake (even though I revised it several times)

Maybe someone got the same problem and can help me out. Thanks in advance.

Here is a new feature which generates a REST interface for your SOAP service. Try that. It supports SOAP-REST conversion automatically.

https://docs.wso2.com/display/AM260/Generate+REST+APIs+from+SOAP+Backends

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM