Mule and Axis

I'm no Axis web service expert, nor do I play one on TV.  I was recently trying to use Mule ESB to consume a web service we have previously created.  However, with the simple "out-of-the-box" configuration below, I was getting a stack trace that nobody seemed to know how to resolve (or nobody was letting on, it seemed).

 <outbound-endpoint
        address="wsdl-axis:http://server:8080/JZip/services/JZip?wsdl&amp;method=unzip"
        synchronous="true" >
    <expression-transformer>
        <return-argument
            expression="//server/path/"
            evaluator="string"/>
        <return-argument
            expression="originalFilename"
            evaluator="header"/>
        <return-argument
            expression="//server/path/"
            evaluator="string"/>
        <return-argument
            expression="N"
            evaluator="string"/>
        <return-argument
            expression="ERROR"
            evaluator="string"/>
    </expression-transformer>
</outbound-endpoint>
 With this stack trace:

org.xml.sax.SAXException: Deserializing parameter 'unzipReturn':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.client.Call.invoke(Call.java:2470)
...

 This is the link that gave me a clue:
http://thread.gmane.org/gmane.comp.java.mule.user/26800


So, I figured out that the "automagic" creation of the axis client by the Mule AxisConnector wasn't generating namespaces in some expected way (or/and whatever else). This meant I had to "learn myself somethin' good" about Axis.  The following configuration is what finally worked for me:


<axis:outbound-endpoint
        address="http://server:8080/JZip/services/JZip?wsdl&amp;method=unzip"
        synchronous="true"
        style="WRAPPED"
        use="LITERAL">
    <axis:soap-method method="qname{jzip:http://JZip.company.com}">
        <axis:soap-parameter
                type="xsd:string"
                parameter="fileLocation"
                mode="IN"/>
        <axis:soap-parameter
                type="xsd:string"
                parameter="fileName"
                mode="IN"/>
        <axis:soap-parameter
                type="xsd:string"
                parameter="targetDir"
                mode="IN"/>
        <axis:soap-parameter
                type="xsd:string"
                parameter="deleteZipFile"
                mode="IN"/>
        <axis:soap-parameter
                type="xsd:string"
                parameter="logLevel"
                mode="IN"/>
        <axis:soap-return type="xsd:string"/>
    </axis:soap-method>
    <expression-transformer>
        <return-argument
                expression="//server/path/"
                evaluator="string"/>
        <return-argument
                expression="originalFilename"
                evaluator="header"/>
        <return-argument
                expression="//server/path/"
                evaluator="string"/>
        <return-argument
                expression="N"
                evaluator="string"/>
        <return-argument
                expression="ERROR"
                evaluator="string"/>
    </expression-transformer>
</axis:outbound-endpoint>

Here are some links at MuleSoft that helps reference this: http://www.mulesoft.org/display/MULE2USER/Axis

Happy Muling!

Comments

Popular Posts