目前,我们正在尝试使用Mule ESB构建一个代理,该代理提供内部Web服务,然后使用内部Web服务的provides参数转到外部soap服务。一旦我得到了,我会改变肥皂的内容和布局。然后在第三步中,结果必须由Mule计算
但在我们进入第2步和第3步之前,让我们先从代理开始。目前我正在查看http://www.mulesoft.org/documentation/display/MULE3USER/Proxying+Web+服务但是,提供的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部分仍然保持不变,并且仍然指向原始位置。更糟糕的是,调用SOAP1.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>
小时>小时>WSProxyService是Mule 2的遗留版本,将不与流一起工作,只与服务一起工作。相反,更喜欢使用其中一种:
- 一种web服务代理模式
- CXF代理,如果您需要比ws代理服务模式提供的更多的控制
如果是代理,则可以使用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>