使用代理服务的服务中介-WSO2

时间:2013-03-04 09:09:44

标签: web-services wso2 wso2esb mediator

我是这个领域的新手,我需要通过ESB访问我的网络服务。正如它在这里提到的那样 - Service Mediation Using Proxy Services我试图创造它。之后我运行它并获得如下响应:

<TryitProxyError xmlns:h="http://wso2.org/ns/TryitProxy"
h:status="SOAP envelope error">org.apache.axis2.AxisFault:
The input stream for an incoming message is null.</TryitProxyError>

但我尝试使用 SOAPUi 运行相同的网络方法,并获得预期的输出,如下所示:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <getPatientHistoryResponse xmlns="http://tilani.lk/">
         <getPatientHistoryResult>
            <NIC>123</NIC>
            <FullName>ABC DEF</FullName>
            <FirstName>ABC</FirstName>
            <Surname>DEF</Surname>
            <Title>Mr.</Title>
            <Gender>M/Gender>
         </getPatientHistoryResult>
      </getPatientHistoryResponse>
   </soap:Body>
</soap:Envelope>

这是什么原因?我使用.net

创建了这个

我的 WSDL地址 - http://localhost:2935/PatientRegService.asmx?WSDL

然后在 定义端点为 - http://localhost:2935/PatientRegService.asmx

修改 我的代理配置如下:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="PatientManagement" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:2935/PatientRegService.asmx?WSDL"/>
      </endpoint>
   </target>
   <publishWSDL uri="http://localhost:2935/PatientRegService.asmx?WSDL"/>
   <description></description>
</proxy>

2 个答案:

答案 0 :(得分:2)

如果您只想通过ESB访问Web服务,则需要创建代理服务并访问代理服务URI而不是原始服务URI。只需按照Pass Through Proxy example

答案 1 :(得分:1)

尝试以下代理,看看你得到了什么。通过源视图编辑器添加此代理配置。

 <proxy xmlns="http://ws.apache.org/ns/synapse"
           name="testProxy"
           transports="https http"
           startOnLoad="true"
           trace="disable">
       <description/>
       <target>
          <inSequence>

             <log level="full">
                <property name="testprop" value="incoming message"/>

             </log>

             <send>
                <endpoint>
                   <address uri="http://localhost:2935/PatientRegService.asmx"/>
                </endpoint>
             </send>
          </inSequence>
          <outSequence>
             <send/>
          </outSequence>
       </target>
    </proxy>