Mule ESB代理Web服务

时间:2012-01-05 13:29:21

标签: esb mule

目前,我们正在尝试使用Mule ESB构建代理,该代理提供内部Web服务,然后使用内部的提供参数转到外部soap服务。一旦我得到了,我将改变肥皂含量和布局。然后第三步结果必须由骡子计算
但在我们到达第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>

2 个答案:

答案 0 :(得分:6)

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

答案 1 :(得分:0)

如果它是代理,那么您可以使用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>