【问题标题】:WSO2 ESB mediate SOAP servicesWSO2 ESB 中介 SOAP 服务
【发布时间】:2012-08-08 22:33:36
【问题描述】:

我正在努力使我在 wso2 esb 中的消息流工作,所以我需要一些帮助来实现基本的通信:

Service1 想要接收一个整数 Service2 生成随机数

Service1 有 InSequence: log, send (to addresspoint specified)。 OutSequence:记录,发送

这看起来像:

 <proxy name="ClientAskNumber" transports="https http" startOnLoad="true"
        trace="disable">
        <target faultSequence="fault">
            <inSequence>
                <log level="full">
                    <property name="Insequence" value="***" />
                </log>
                <send>
                    <endpoint>
                        <address uri="http://localhost:8280/services/RandomNumbers" />
                    </endpoint>
                </send>
            </inSequence>
            <outSequence>
                <log level="full">
                    <property name="Outsequence" value="***" />
                </log>
                <send />
            </outSequence>
        </target>
    </proxy>

我有这个回复:&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()....etc

这是什么意思?我还缺少其他东西吗?请帮忙。谢谢

编辑:

我正在研究 Wso2 ESB,我只需要了解如何使工作成为消息通信,之后我将尝试添加不同类型的中介。我只是在解决这个问题,因为我是这项技术的新手,正如你所看到的,我真的很难让它发挥作用......

EDIT2:*

<proxy xmlns="http://ws.apache.org/ns/synapse" name="ClientAskNumber" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target endpoint="RandomNumbers">
      <inSequence>
         <log>
            <property name="CLIENTASKS" value="******C_ASKS" />
         </log>
         <send>
            <endpoint key="RandomNumbers" />
         </send>
      </inSequence>
      <outSequence>
         <log>
            <property name="CLIENTRECEIVES" value="*******C_RECEIVES" />
         </log>
      </outSequence>
   </target>
</proxy>

【问题讨论】:

  • 查看您的序列,您似乎只是将传入请求转发到地址端点?您可以使用 WSO2 的 pass through 代理很好地实现上述功能吗?您能否详细说明您要实现的目标?
  • 我正在研究 Wso2 ESB,我只需要了解如何使工作成为消息通信,之后我将尝试添加不同类型的中介。我只是在解决这个问题,因为我是这项技术的新手,正如你所看到的,我真的很难让它发挥作用......
  • 我已经从这个问题中删除了carbon 标签,因为它不相关。

标签: soap wso2 wso2esb axis2


【解决方案1】:

这是我可以告诉你的流程.. 您必须将您的第二个服务指向您的第一个服务的端点。在上面的配置中

http://localhost:8280/services/RandomNumbers --->2nd service url
ClientAskNumber -->1st service..

现在您可以发送执行第二个服务所需的请求(即:检索随机数) 因此,代理将转发到该端点并将响应返回到外部序列。您应该在控制台/日志中看到它,因为您使用了日志中介。

在您收到的错误响应中,我希望您是从第二次服务中获得的。检查您是否向端点发送正确的请求

【讨论】:

  • ws.apache.org/ns/synapse" name="ClientAskNumber" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
  • 但是指向 url 和作为端点密钥是相同的......你的配置是正确的(我更正了一点)......关键是你必须将你的第二个服务正确地指向端点......并且执行你的代理
  • 您可以查看此示例并了解要指向的内容和位置wso2.org/project/esb/java/4.0.0/docs/samples/…
  • 所以看起来我的序列是正确的,问题出在其他地方:“服务器无法识别 HTTP Header SOAPAction 的值:urn:mediate。” ...谢谢你的帮助
  • ..也许我需要在标题中指定:Action=urn:getNumber ?
【解决方案2】:

如果这对其他人有帮助:"Server did not recognize the value of HTTP Header SOAPAction: urn:mediate..." 的问题是我需要在我的 InSequence 中添加一个 Header 调解器以便调用我的 Web 服务方法“getNumbers”,如下所示:

 <inSequence>
         <log>
            <property name="CLIENTASKS" value="******C_ASKS" />
         </log>
         <header name="Action" value="http://tempuri.org/getNumbers" />
         <send>
            <endpoint key="RandomNumbers" />
         </send>
      </inSequence>

并通过soapUI发送这个请求:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Numbers xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

我希望这对其他使用带有 WSO2ESB 的 .Net 解决方案的人有用(不幸的是,没有太多示例......)

附:感谢 Ratha 的帮助

【讨论】:

  • 对于那些使用 WCF(.Net 解决方案)的人来说只是一些额外的信息:可以在 wcf 服务的 wsdl 中找到标头的值(在本例中为 tempuri.org/getNumbers)。在 wsdl 中有一个名为“操作”的元素 ()。在操作元素内部,有一个名为 的子元素,它有一个名为“Action”的属性。该属性的价值就是我们要寻找的。​​span>
猜你喜欢
  • 2012-08-31
  • 1970-01-01
  • 2013-01-09
  • 2012-08-31
  • 1970-01-01
  • 1970-01-01
  • 2012-08-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多