Reputation: 771
Requirement is to bring CXF service in mule. As per my knowledge i tried creating the configuration in mule but getting an error as shown below.
Exception while executing:
(payload.ns0#ValidateVIN.*ns0#VIN map ((vIN , indexOfVIN) -> {
^
Type mismatch for 'map' operator
found :null, :function
required :array, :function.
Attaching the code below.
<?xml version="1.0" encoding="UTF-8"?>
<mule ... >
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="9009" basePath="Mule" doc:name="HTTP Listener Configuration"/>
<cxf:configuration name="Autoprefill_CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" doc:name="CXF Configuration"/>
<flow name="autoprefillFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/VINService" allowedMethods="POST" doc:name="HTTP"/>
<logger message="#[message.payloadAs(String)]" level="INFO" doc:name="Logger"/>
<dw:transform-message doc:name="Transform Message" metadata:id="566ab616-f256-4763-af42-82d4cbbcc277">
<dw:input-payload mimeType="application/xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/xml
%namespace ns0 http://www.pwc.com/vin
---
{
ns0#ValidateVIN: {
(payload.ns0#ValidateVIN.*ns0#VIN map ((vIN , indexOfVIN) -> {
ns0#VIN: vIN
}))
}
}]]></dw:set-payload>
</dw:transform-message>
<cxf:simple-client operation="validateVIN" serviceClass="autoprefill.VINPort" doc:name="CXF"/>
<logger message="#[message.payloadAs(String)]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
I tried removing the message transform property, but that time i got the below error
java.lang.String cannot be cast to java.util.Collection. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor
The service is expecting a list of string. Im not sure how that can be done in mule. Any help will be much appreciated.
Upvotes: 0
Views: 1381
Reputation: 55
The problem is in the Transform Message
component.
The map function is expecting an array of data (collection of data), but it did not receive any value.
I suggest to check the payload before Transform Message
component. Perhaps payload is not in expected format. If you can share the payload (or full logs at least) here, I can help you with the transformation.
Upvotes: 1