【问题标题】:Mule ESB Proxy webserviceMule ESB 代理网络服务
【发布时间】:2012-01-05 13:29:20
【问题描述】:

目前我们正在尝试使用 Mule ESB 构建一个代理,它提供一个内部 web 服务,然后使用内部服务的提供参数转到一个外部soap 服务。一旦我明白了,我会改变肥皂的含量和布局。然后第三步,结果必须由Mule计算。

但在我们到达第 2 步和第 3 步之前,让我们先从代理开始。目前我正在查看http://www.mulesoft.org/documentation/display/MULE3USER/Proxying+Web+Services 但是,提供的 WSProxyService 不起作用。该代码似乎适用于 Mule 2.2。我尝试重新创建它,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd">

    <spring:bean name="WSProxyService" class="org.mule.module.cxf.WSProxyService">
        <spring:property name="wsdlFile" value="resources/tisclientws.wsdl"/>
    </spring:bean>

  <flow name="HttpProxyService">
      <http:inbound-endpoint address="http://localhost:8090/tis/proxy" exchange-pattern="request-response"/>
      <component>
        <spring-object bean="WSProxyService" />
      </component>
      <http:outbound-endpoint address="ADDRESSHERE/tisclientws.asmx" exchange-pattern="request-response"/>
  </flow>
</mule>

然而这给出了错误

Exception stack is:
1. Service not set, this service has not been initialized properly. (org.mule.api.lifecycle.InitialisationException)
  org.mule.module.cxf.WSProxyService:254 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/lifecycle/InitialisationException.html)

谁能帮帮我?我尝试了各种事情,但没有任何运气。

最后但同样重要的是,我还查看了http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF,但问题在于提供的内部服务有多个参数并且没有内部 WSDL。


感谢您的回复,帮助很大。经过反复试验,我明白了……有点……

目前代理为我提供了一个本地 WSDL(按预期工作)。然而,仔细检查后,WSDL 的 SOAP 1.2 部分保持不变,仍然指向原始位置。更糟糕的是,调用 SOAP 1.1 部分时会出错(而原始版本可以正常工作)。

所以我正朝着正确的方向前进。现在只是为了解决这些问题。

除此之外,也许有人可以指出我正确的方向。假设我想从外部服务获取输出,只计算所有小时数,然后以 XML 形式将其返回给本地服务。这是否属于自定义转换器类别?

我使用了以下代码:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xsi:schemaLocation="
          http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
          http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd
          http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd">
    <flow name="test">
        <http:inbound-endpoint address="http://localhost:8090/tis/proxy" exchange-pattern="request-response"/>      
        <cxf:proxy-service
           wsdlLocation="services/tisclientws.wsdl" 
           service="tisclientws"
           namespace="NAMESPACEHERE"
           validationEnabled="true"
           enableMuleSoapHeaders="false"
        />
        <http:outbound-endpoint address="EXTERNALURL/tisclientws.asmx" exchange-pattern="request-response"/>
    </flow>
</mule>

从 SOAP 1.1 收到的错误:

 <faultstring>Schema validation error on message from client: tag name "icTables" is not allowed. Possible tag names are: &lt;iiBSNNummer>.</faultstring>

禁用验证后,错误变为:

 <faultcode>soap:Server</faultcode>
         <faultstring>Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=EXTERNALADDRESS/tisclientws.asmx, connector=HttpConnector
{
  name=connector.http.mule.default
  lifecycle=start
  this=17b79a6
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[http]
  serviceOverrides=&lt;none>
}
,  name='endpoint.EXTERNALADDRESS.tisclientws.asmx', mep=REQUEST_RESPONSE, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: DepthXMLStreamReader</faultstring>

【问题讨论】:

    标签: esb mule


    【解决方案1】:

    WSProxyService 是 Mule 2 的遗留物,不能用于流,只能用于服务。而是更喜欢使用:

    【讨论】:

    • 我可以使用 web-service-proxy 模式,但我需要将响应写入 sftp 服务器上的文件中。似乎找不到任何附加 sftp 端点的方法。任何帮助将不胜感激
    【解决方案2】:

    如果它是代理,那么您可以使用 Web 服务代理模式。

        <pattern:web-service-proxy
            xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
            wsdlLocation="${worker.wsdlLocation}"
            name="WorkerDummy-WSProxyRequestOrder"
            inboundAddress="${worker.inboundAddress}"
            outboundAddress="${worker.outboundAddress}">
        </pattern:web-service-proxy>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-15
      相关资源
      最近更新 更多