如何在WSO2代理中调用webservice

时间:2013-11-25 09:05:33

标签: wso2 wso2esb

如何在代理内部调用Web服务?代理本身工作正常,我在“in”序列中添加了日志Web服务的调用。我使用有效负载工厂+发送创建呼叫。

问题是,该代理现在返回此日志记录Web服务的结果而不是 应该返回什么样的Web服务。在“out”序列中定义了地址结束点。

我正在使用WSO2 ESB 4.6.0。

2 个答案:

答案 0 :(得分:2)

这是在代理中调用Web服务的简单示例。您需要在创建代理之前启动后端服务

<proxy xmlns="http://ws.apache.org/ns/synapse" name="customPro" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
      </inSequence>
      <out-sequence>
         <send/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
   <description></description>
</proxy>

您需要在标记

的终点内定义Web服务网址

同样,这种发送中介返回对outSequence的端点响应 默认情况下。

如果您通过以下网址

浏览ESB文档,您可以很好地理解这些内容

http://docs.wso2.org/display/ESB460/Samples

如果您需要进一步的帮助,请随时询问

答案 1 :(得分:1)

有两种方法可以实现日志

<强> 1。通过有线日志记录ESB传入和传出消息。

为线路日志启用调试模式; - ESB控制台&gt;配置&gt;记录 - 将“org.apache.synapse.transport.http.wire”级别设置为“DEBUG”。

在日志中,它表示&gt;&gt;传入消息到ESB

                 <<  outgoing messages from  ESB

<强> 2。在适当的地方使用日志

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="TestProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="full">
            <property name="test" value="incomming to ESB-----------------------"/>
         </log>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
         <log level="full">
            <property name="test" value="outcomming from ESB-----------------------"/>
         </log>
      </inSequence>
      <outSequence>
         <log level="full">
            <property name="test" value="incomming to ESB-----------------------"/>
         </log>
         <send/>
         <log level="full">
            <property name="test" value="outcomming from ESB-----------------------"/>
         </log>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
   <description/>
</proxy>

如果它可以解决您的问题,请标记为已回答。

相关问题