2016-07-18 13 views
0

私は2つの異なるサービスから2つの応答を結合しようとしています。私はこれを達成するために多くのアプローチを試みました。これまでのところ、これは私が得たものです。ここwso2残りのAPIのクローンと集約

<?xml version="1.0" encoding="UTF-8"?> 
<api context="/movieapi" name="movieapi" xmlns="http://ws.apache.org/ns/synapse"> 
    <resource methods="GET" uri-template="/*"> 
     <inSequence> 
      <property name="ROOT" scope="default"> 
       <root:rootelement xmlns:root="www.wso2esb.com"/> 
      </property> 
      <log level="full"/> 
      <clone continueParent="true" id="movie" sequential="true"> 
       <target> 
        <sequence> 
         <send> 
          <endpoint> 
           <address format="rest" trace="disable" uri="http://localhost:8280/moviedbapi/movie/tt0918940?api_key=code"/> 
          </endpoint> 
         </send> 
        </sequence> 
       </target> 
       <target> 
        <sequence> 
         <send> 
          <endpoint> 
           <address format="rest" trace="disable" uri="http://localhost:8280/omdbapi/?type=movie&amp;i=tt0918940"/> 
          </endpoint> 
         </send> 
        </sequence> 
       </target> 
      </clone> 
     </inSequence> 
     <outSequence> 
      <aggregate> 
       <completeCondition> 
        <messageCount max="-1" min="-1"/> 
       </completeCondition> 
       <onComplete enclosingElementProperty="ROOT" expression="//return"> 
        <respond/> 
       </onComplete> 
      </aggregate> 
     </outSequence> 
     <faultSequence/> 
    </resource> 
</api> 

は 応答である[1] http://pastebin.com/mTzYAkNB [2] http://pastebin.com/v3GQ3kbD

答えて

1

はAPIを、次の試してみてください。

<?xml version="1.0" encoding="UTF-8"?> 
<api context="/movieapi" name="movieapi" xmlns="http://ws.apache.org/ns/synapse"> 
<resource methods="GET" uri-template="/*"> 
    <inSequence> 
     <property name="ROOT" scope="default"> 
      <root:rootelement xmlns:root="www.wso2esb.com"/> 
     </property> 
     <log level="full"/> 
     <clone continueParent="true" id="movie" sequential="true"> 
      <target> 
       <sequence> 
        <send> 
         <endpoint> 
          <address format="rest" trace="disable" uri="http://localhost:8280/moviedbapi/movie/tt0918940?api_key=code"/> 
         </endpoint> 
        </send> 
       </sequence> 
      </target> 
      <target> 
       <sequence> 
        <send> 
         <endpoint> 
          <address format="rest" trace="disable" uri="http://localhost:8280/omdbapi/?type=movie&amp;i=tt0918940"/> 
         </endpoint> 
        </send> 
       </sequence> 
      </target> 
     </clone> 
    </inSequence> 
    <outSequence> 
     <aggregate> 
      <completeCondition> 
       <messageCount max="-1" min="-1"/> 
      </completeCondition> 
      <onComplete enclosingElementProperty="ROOT" expression="//return"> 
      <property name="messageType" scope="axis2" type="STRING" value="application/json"/> 
       <respond/> 
      </onComplete> 
     </aggregate> 
    </outSequence> 
    <faultSequence/> 
</resource> 
</api> 
関連する問題