2016-08-02 3 views
0

私はWSO2 Enterprise Service BusにREST APIを作成しました。 2つのノードとJSONを返すSOAPUI上のモックサービスへ API呼び出し:WSO2のAPI ESBはJSONの最初のノードのみを返しますか?

{ 
    "customer" : { 
     "value1": "2312", 
     "value2": "3214", 
     "value3": "4214" 
    }, 
    "msg" : "error" 
} 

ESBは、このJSONを返す必要がありますが、それは常に、第2ノード(「MSG」)を無視し、ちょうど最初のノードを返します。

は、私はすでに、このような何かを位置を変更したが、それは動作しますしません:

{ 
    "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> 

を私はしましたすでにモックをチェックして、私のAPIは、最初のノードを返してなぜそれがESB

に右答えるのか?

マイワイヤーログ:

[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]" 
+1

'log4j.logger.org.apache.synapse.transport.http.wireを追加してください。 = DEBUG'をlog4j.propertiesファイルに追加し、質問をワイヤログで更新します。 – Bee

+0

あなたのESBのバージョンは? –

+1

また、axis2.xmlにapplication/json用にコンフィグレーションされたメッセージビルダ/フォーマッタは何ですか? –

答えて

1

理想的には、これは何かを返すことはできません。 の中に<send/>メディエーターを追加することで問題を解決する必要があります。ワイヤログを有効にし、それ以外の場合はチェックすることができます。

+0

私は遅れてを追加しました。 APIが応答しますが、JSONの最初のノードだけが応答します。 を使ってみましたが、同じ問題がありました。 –

+0

コメントにBathiyaが示唆しているようにワイヤーログを有効にして、ワイヤーログをその質問に編集として貼り付けてください。 –

+0

すみません。私はバティヤのメッセージを見ませんでした。私はワイヤーログを貼りつけるつもりです。 –

0

私が推測すると、メッセージフローは正しくJSON形式を識別しない場合があります。次のように順序を変更し、これを試してみてください:

<outSequence xmlns="http://ws.apache.org/ns/synapse"> 
<property name="messageType" value="application/json" scope="axis2" type="STRING"></property> 
<send/> 
</outSequence> 

あなたが使用することができ、複雑なJSONレスポンスの場合:

<outSequence xmlns="http://ws.apache.org/ns/synapse"> 
<property name="messageType" value="application/json/badgerfish" scope="axis2" type="STRING"></property> 
<send/> 
</outSequence> 
関連する問題