Reputation: 517
Mule 3.3.1 CE
I'm probably going to kick myself, but what's going on with the following?
I have a private flow that takes in an XML payload and extracts a value among other things. This cut-down example works.
<flow name="MyFlow">
<set-session-variable variableName="xyzMethod" value="#[xpath:local-name(/S:Envelope/S:Body/*[1])]"/>
</flow>
I want to put a VM inbound endpoint on this to solve some reuse issues. However, when I do, I get an exception on that xpath invocation. This exhibits the problem.
<flow name="MyFlow">
<vm:inbound-endpoint exchange-pattern="request-response" path="execute.xyz"/>
<set-session-variable variableName="dnbMethod" value="#[xpath:local-name(/S:Envelope/S:Body/*[1])]"/>
</flow>
I'm not seeing something obvious. What does the insertion of the VM endpoint do that is causing this?
Message : There are two transformers that are an exact match for input: "class java.lang.String", output: "interface org.dom4j.Document". Transformers are: "XmlToDom4jDocument(class org.mule.module.xml.transformer.XmlToDomDocument)" and "XmlToDom4jDocument(class org.mule.module.xml.transformer.XmlToDomDocument)"
Code : MULE_ERROR-255
EDIT based upon discussion below
Based upon the discussion of trying MEL syntax, here are some results.
The input is (except for security info):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://applications.dnb.com/webservice/schema/">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<sch:AdvancedCompanySearchRequest>
</sch:AdvancedCompanySearchRequest>
</soapenv:Body>
</soapenv:Envelope>
The following is the exact code that executes successfully. I see AdvancedCompanySearchRequest in the console.
<flow name="ExecuteDandB" doc:name="ExecuteDandB">
<!-- <vm:inbound-endpoint exchange-pattern="request-response" path="execute.dnb" doc:name="DnB"/>-->
<set-session-variable variableName="dnbMethod" value="#[xpath:local-name(/S:Envelope/S:Body/*[1])]"/>
<!-- <set-session-variable variableName="dnbMethod" value="#[xpath('/S:Envelope/S:Body/*[1]').name]"/>-->
<logger level="INFO" message="#[sessionVars['dnbMethod']]"/>
</flow>
The following is the exact code that fails to execute. I see the exception about two transformers described above.
<flow name="ExecuteDandB" doc:name="ExecuteDandB">
<!-- <vm:inbound-endpoint exchange-pattern="request-response" path="execute.dnb" doc:name="DnB"/>-->
<!-- <set-session-variable variableName="dnbMethod" value="#[xpath:local-name(/S:Envelope/S:Body/*[1])]"/>-->
<set-session-variable variableName="dnbMethod" value="#[xpath('/S:Envelope/S:Body/*[1]').name]"/>
<logger level="INFO" message="#[sessionVars['dnbMethod']]"/>
</flow>
Upvotes: 1
Views: 1659
Reputation: 11
You'll find the solution here:
http://forum.mulesoft.org/mulesoft/topics/no_idea_why_i_am_getting_this_error-csv8r
It's about having two copies of mule-module-xml.jar in your classpath.
Upvotes: 1