1
votes

Currently we are trying to build a proxy with Mule ESB that provides an internal webservice and then goes to an external soap service with the provides parameters of the internal one. Once I got that, I'll alter the soap content and lay-out. Then the third step the results have to be calculated by Mule.

But before we reach step 2 and 3, lets first start with the proxy. Currently I am looking at http://www.mulesoft.org/documentation/display/MULE3USER/Proxying+Web+Services However the WSProxyService provided does not work. The code seems to be for Mule 2.2. I tried recreating it which looks like this:

<?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>

This however gives the error

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)

Can anyone help me? I tried various things without any luck.

Last but not least, I also looked at http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF but the problem there is multiple parameters and no internal WSDL from the provided internal service.


Thanks for the reply, it helped a lot. After some trial and error, I got it... sort of...

Currently the proxy gives me a local WSDL (working as intended). However upon closer inspection the SOAP 1.2 section of WSDL remains unaltered and still points towards the original location. To make matters worse, the SOAP 1.1 section when invoked, gives an error (while the original version works fine).

So I am heading in the right direction. Now just to fix these problems.

Besides that, maybe somebody can point me in the right direction. Lets say I want to take the output from the external service and only calculate all the hours and throw that back to the local service in an XML-form. Does that fall under the custom transformer category?

I used the following code:

<?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>

The error received from SOAP 1.1:

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

Upon disabling validation, the error changes to:

 <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

2 Answers

6
votes

The WSProxyService is a legacy from Mule 2 and will not work with flows, only services. Instead prefer using either:

0
votes

If it is a proxy then you may use a Web Service Proxy Pattern.

    <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>