Search code examples
wso2jmswso2-enterprise-integratorwso2-micro-integrator

Error "First Element must contain the local name, Envelop" when consuming JMS messages


While my listener runs it gives this error as soon as I run it. Unable to figure out what does it

2023-02-01 16:33:59,899] ERROR {JMSMessageReceiver} - Unknown error processing message org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found prov

Payload I am listening starts like below:

<prov><rowID>122</rowID><msisdn>110000171</msisdn>

Below is the settings of config in proxy service I am listening the msg from:

<parameter name="transport.jms.Destination">PROV.MAP.RT</parameter>
<parameter name="transport.jms.ContentType">text/xml</parameter>
<parameter name="transport.jms.ConnectionFactory">ProvMapperRealtimeListener</parameter>

Solution

  • If you are using JMS Inbound Endpoint to listen to the queue, set the following property in the Inbound EP configs.

    <parameter name="transport.jms.ContentType">application/xml</parameter>
    

    Update

    In your Proxy configuration change the following property.

    <parameter name="transport.jms.ContentType">application/xml</parameter>
    

    Explanation

    When a message comes into WSO2 it would be converted to a processable format based on the Content-Type of the message. For this WSO2 uses message builders, the appropriate builder is selected based on the Content-Type. By default text/plain Content-Type is built with the SOAP message builder, hence it expects a proper SOAP message body. Since you have an XML instead it fails with the aforementioned error. Once you change the Content-Type to application/xml it would be built as an XML.