我在WSO2 Enterprise Service Bus中創建了一個REST API。 的API調用上了SoapUI一個模擬服務,它返回一個JSON有2個節點:WSO2 ESB中的API只返回JSON的第一個節點?
{
"customer" : {
"value1": "2312",
"value2": "3214",
"value3": "4214"
},
"msg" : "error"
}
ESB應該返回此JSON,但它總是忽略第二個節點(「味精」),並只返回的第一個節點。
我已經改變了位置,這樣的事情,但它並不作品:
{
"msg" : "error",
"customer" : {
"value1": "2312",
"value2": "3214",
"value3": "4214"
}
}
的API是非常簡單的,像這樣:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/test1" name="test" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" protocol="http">
<inSequence>
<send>
<endpoint key="conf:/endpoint.xml"/>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
我已經已經檢查了模擬,它正在回答ESB
爲什麼我的API只返回第一個節點?
我的線日誌:
[2016-08-03 14:04:14,343] DEBUG - wire >> "POST /CustomerHSF/retrieveCustomerHSF HTTP/1.1[\r][\n]"
[2016-08-03 14:04:14,344] DEBUG - wire >> "HOST: localhost:8283[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> "content-type: application/json[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> "content-length: 100[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> "[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> "{[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> ""nomCliente": "SILVA",[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> ""tipoPessoa": "FIS",[\r][\n]"
[2016-08-03 14:04:14,345] DEBUG - wire >> ""dscEmail": "[email protected]"[\r][\n]"
[2016-08-03 14:04:14,346] DEBUG - wire >> "}[\r][\n]"
[2016-08-03 14:04:14,347] INFO - LogMediator Starting inSequence retrieveCustomerHSF = Starting inSequence retrieveCustomerHSF
[2016-08-03 14:04:14,349] DEBUG - wire << "POST /integradorhsf/clientes/ HTTP/1.1[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "Content-Type: application/json; charset=UTF-8[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "Host: localhost:8082[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "[\r][\n]"
[2016-08-03 14:04:14,349] DEBUG - wire << "64[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << "{[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << ""nomCliente": "SILVA",[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << ""tipoPessoa": "FIS",[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << ""dscEmail": "[email protected]"[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << "}[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << "[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << "0[\r][\n]"
[2016-08-03 14:04:14,350] DEBUG - wire << "[\r][\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "Content-Type: application/json[\r][\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "Content-Length: 47[\r][\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "Server: Jetty(6.1.26)[\r][\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "[\r][\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "{[\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> ""retorno": "dados cliente",[\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> ""msg": "error"[\n]"
[2016-08-03 14:04:14,356] DEBUG - wire >> "}[\n]"
[2016-08-03 14:04:14,360] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:117c7eb8-c4f2-40a4-b26d-73f64863303a, Direction: response, Starting outSequence retrieveCustomerHSF = Starting outSequence retrieveCustomerHSF, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><retorno>dados cliente</retorno></soapenv:Body></soapenv:Envelope>
[2016-08-03 14:04:14,369] DEBUG - wire << "HTTP/1.1 200 OK[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "Content-Type: application/json; charset=UTF-8[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "Date: Wed, 03 Aug 2016 17:04:14 GMT[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "1b[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "{"retorno":"dados cliente"}[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "0[\r][\n]"
[2016-08-03 14:04:14,369] DEBUG - wire << "[\r][\n]"
請加上'log4j.logger.org.apache.synapse.transport.http.wire = DEBUG'到log4j.properties文件並使用連線日誌更新問題。 – Bee
什麼是您的ESB版本? –
在axis2.xml中爲application/json配置的消息生成器/格式化程序是什麼? –