【发布时间】: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: <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=<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>
【问题讨论】: