【问题标题】:Service Mediation Using Proxy Services -WSO2使用代理服务的服务中介 -WSO2
【发布时间】:2013-03-04 09:09:43
【问题描述】:

我是这个领域的新手,我需要通过 ESB 访问我的 Web 服务。正如这里提到的 - 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>

【问题讨论】:

  • 你的代理配置是什么?
  • @Ratha - 我对这个领域完全陌生,我尝试了这里提到的docs.wso2.org/wiki/display/ESB460/Quick+Start+Guide 的客户代理,然后尝试使用 maninda 提到的通过代理.. 但仍然无法配置它。
  • 你能给你的直通代理配置(即:突触配置)添加一个示例配置吗..检查一下,看看你是否得到响应。

标签: web-services wso2 wso2esb mediator


【解决方案1】:

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

【讨论】:

  • 在上面的示例中,如果我们选择 Target Endpoint 作为 Enter URL,我们是否需要为此提供 WSDL 路径?对于上述我的情况,我需要给http://localhost:2935/PatientRegService.asmx?WSDL
  • 我尝试过链接。但仍然给我同样的错误信息。
  • 在通过代理时,只应给出端点 URL。例如,尝试使用 ESB 本身默认托管的 echo 服务中的 http 端点 URL。
  • thanx maninda.. 我可以配置 esb。我忘了在 iis 中托管 web 服务。这就是给我这个错误的原因。我可以使用直通代理连接它。
【解决方案2】:

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

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

【讨论】:

  • 我试过这个并选择端点为PatientManagementHttpEndpoint 然后它给出相同的消息-The input stream for an incoming message is null. (将尝试私有代理协议,因为可能会为此端点强制执行跨域浏览器限制。)
  • 当我尝试使用PatientManagementHttpSoap11Endpoint 时,它会出现以下错误&lt;faultcode&gt;soap:Client&lt;/faultcode&gt; &lt;faultstring&gt;System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: urn:mediate. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create
  • 如果你注意到上面的代理配置我们没有添加wsdl。SO,如果你检查代理的WSDL,它是一个默认的wsdl,它与你的后端服务无关.您需要做的是,使用您的实际后端服务 WSDL 创建一个 soapui 项目,并将该请求发送到此代理。代理会将请求路由到后端服务。
  • 我可以配置 esb。我忘了在 IIS 中托管 Web 服务。这就是给我这个错误的原因。我可以使用直通代理连接它。无论如何谢谢你的帮助。
猜你喜欢
  • 2013-01-09
  • 2012-08-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-15
  • 2020-04-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多