我在代理服务中使用WSO2 ESB Twitter连接器操作。代理配置如下所示
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="twitter_test_proxy" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<twitter.init configKey="twitter_init"/>
<twitter.getTopTrendPlaces configKey="twitter_init">
<id>23424975</id>
</twitter.getTopTrendPlaces>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>
我将twitter连接器导入esb并启用它。然后,所有工件(代理服务和twitter_init本地条目)都部署在ESB中。一旦我调用代理服务,就注意到twitter连接器没有调用预期的后端twitter API。我已启用了线程调试和调试日志,如下所示。这是什么原因?我正在使用WSO2 ESB 4.8.1。我按照here给出的说明创建了配置
[2014-11-12 20:07:47,785] DEBUG - header >> "POST /services/twitter_test_proxy.twitter_test_proxyHttpSoap12Endpoint HTTP/1.1[\r][\n]"
[2014-11-12 20:07:47,793] DEBUG - header >> "Content-Type: application/soap+xml; charset=UTF-8; action="urn:mediate"[\r][\n]"
[2014-11-12 20:07:47,793] DEBUG - header >> "Cookie: menuPanel=visible; menuPanelType=main; wso2.carbon.rememberme=admin-60c7726f-6e4b-462c-88c2-13753ab95974; JSESSIONID=6297A74817478FFE0F4B6EB392022E29; requestedURI="../../carbon/service-mgt/index.jsp?region=region1&item=services_list_menu"; region1_configure_menu=none; region3_registry_menu=none; region4_monitor_menu=none; region5_tools_menu=none; MSG14156327996440.7180992366157122=true; MSG14156330072650.6915075827877599=true; current-breadcrumb=manage_menu%2Cservices_menu%2Cservices_list_menu%23proxyservices+index.jsp*+index.jsp*; MSG14157205387400.9361328898335365=true; MSG14157205491900.33127844546453067=true; MSG14157205807580.7846254111223301=true; MSG14157216353420.11143615454004241=true[\r][\n]"
[2014-11-12 20:07:47,793] DEBUG - header >> "User-Agent: Axis2[\r][\n]"
[2014-11-12 20:07:47,793] DEBUG - header >> "Host: asanka-virtual-machine:8280[\r][\n]"
[2014-11-12 20:07:47,794] DEBUG - header >> "Transfer-Encoding: chunked[\r][\n]"
[2014-11-12 20:07:47,794] DEBUG - header >> "[\r][\n]"
[2014-11-12 20:07:47,794] DEBUG - content >> "a0[\r][\n]"
[2014-11-12 20:07:47,794] DEBUG - content >> "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope>"
[2014-11-12 20:07:47,795] DEBUG - content >> "[\r][\n]"
[2014-11-12 20:07:47,796] DEBUG - content >> "0"
[2014-11-12 20:07:47,796] DEBUG - content >> "[\r][\n]"
[2014-11-12 20:07:47,797] DEBUG - content >> "[\r][\n]"
答案 0 :(得分:0)
我可以通过稍微修改代理来解决上述问题。我添加了响应中介并得到了预期的结果。工作代理如下所示。
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="twitter-connector-proxy" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="full">
<property name="INIT" value="##### Call to the Proxy #####"/>
</log>
<twitter.init/>
<twitter.search configKey="twitter_init">
<search>cricket</search>
</twitter.search>
<log level="full">
<property name="RESULT" value="#### Twitter Search Result ####"/>
</log>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>