Search code examples
soapmuleesb

How get payload inside webservice class mule


I need payload value inside ShipmentProcessImpl class or MuleEventContext object.

    <flow name="soaptest_rFlow1" doc:name="soaptest_rFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
host="${host}" port="${port}" doc:name="HTTP" path="${deliveryUpdatePath}" />
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
<logger category="ProTSP Listener Logger" level="INFO" message="#[payload]"
doc:name="Logger" />

<cxf:jaxws-service serviceClass="org.tempuri.ShipmentProcess"
doc:name="CXF" />
<component class="org.tempuri.ShipmentProcessImpl" doc:name="Java" />
</flow>

I am able to get MuleContext class object using @Lookup annotation but I am unable to get payload using mulecontext object.

Can any other way to get payload inside webservice class.


Solution

  • MuleContext is the active context of the running Mule application, it is unrelated to the current MuleEvent being processed by the flow.

    You need to get a hold of MuleEventContext via a static call to org.mule.RequestContext.getEventContext().

    Yes, it is deprecated, but it still works and, to be frank, I don't know of an alternative for service class implementations...