Thamu
Thamu

Reputation: 67

WSO2 EI: First Element must contain the local name, Envelope , but found html

I'm retrieving some data's from the DSS using select query after that, I do some transformation using payload factory and then send it to an endpoint but when I do that First Element must contain the local name, Envelope , but found html error please help me to sort this out.

<sequence name="ValidateRecordExistanceInDB" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
    <format>
        <p:select_with_key_novum_extension_operation xmlns:p="novum.service">
            <xs:Id xmlns:xs="novum.service">$1</xs:Id>
        </p:select_with_key_novum_extension_operation>
    </format>
    <args>
        <arg evaluator="xml" expression="get-property('Extension')"
            literal="false" xmlns:ns="http://org.apache.synapse/xsd"/>
    </args>
</payloadFactory>
<property name="REST_URL_POSTFIX" scope="axis2" type="STRING" value=""/>
<property name="HTTP_METHOD" scope="axis2" type="STRING" value="POST"/>
<property name="ContentType" scope="axis2" type="STRING" value="text/xml"/>
<property name="Accept" scope="transport" type="STRING" value="text/xml"/>
<property expression="$ctx:config//*[local-name()='localHost']"
    name="localHost" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<header
    expression="concat($ctx:localHost, '/services/NovumAudioValidationDataRetrievalService')"
    name="To" scope="default" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="SOAPAction" scope="transport" type="STRING" value="select_with_key_novum_extension"/>
<call>
    <endpoint>
        <default format="soap11">                
        </default>
    </endpoint>
</call>
<filter xmlns:ds="novum.service"
    xmlns:ns="http://org.apache.synapse/xsd" xpath="boolean(//ds:novum_extensionCollection/ds:novum_extension)">
    <then>
        <property expression="//*[local-name()='Department']" name="department"/>
        <property expression="//*[local-name()='Username']" name="username"/>
        <property expression="//*[local-name()='Extension']" name="extension"/>
        <property expression="//*[local-name()='Novum_Extension']" name="novumExtension"/>
        <property expression="//*[local-name()='email']" name="email"/>
        <property expression="//*[local-name()='location']" name="location"/>
        <property expression="//*[local-name()='selling_dealer__c']" name="selling_dealer__c"/>            
        <log level="custom">
            <property
                expression="concat('successfully retrieved record with extension ', $ctx:Rec_Id, ' from the db')" name="novum-api-status"/>
            <property expression="$ctx:department" name="department"/>
            <property expression="$ctx:location" name="location"/>
            <property expression="$ctx:username" name="username"/>
            <property expression="$ctx:email" name="notifierEmail"/>
            <property expression="$ctx:selling_dealer__c" name="selling_dealer__c"/>
        </log>
    </then>
    <else>
        <log level="custom">
            <property
                expression="concat('record with extension ', $ctx:Rec_Id, ' not found in the db, sending out error email notification')" name="novum-api-status"/>
        </log>
        <property
            expression="concat('Record with Novum Extension ', $ctx:Rec_Id, ' can not be found in the database.')" name="errorMsg"/>
        <sequence key="NotifyErrorSubscribers"/>
        <drop/>
    </else>
</filter>    

Log error Script Sequence 1 Sequence 2

Thanks!

Upvotes: 2

Views: 967

Answers (2)

Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

I had similar issue, and I was getting html response from the endpoint instead of JSON response, but I couldn't see the html response so I enabled the following in <EI_HOME>/conf/log4j2.properties and restarted WSO2

logger.httpclient-wire-content.level=TRACE

logger.synapse-transport-http-wire.level=TRACE

logger.httpclient-wire-header.level=TRACE

After enabling logging I was able to see the response HTML which was a Support ID by Load Balancer

reference is : https://docs.wso2.com/display/EI660/Logs+in+WSO2+EI+6.6.0#LogsinWSO2EI6.6.0-Wirelogs(fortheESBprofile)

Also It's better If you enabled message formatters and message builders in deployment.toml

[[custom_message_formatters]]
content_type = "text/html"
class = "org.apache.axis2.format.PlainTextFormatter"

[[custom_message_builders]]
content_type = "text/html"
class = "org.apache.axis2.format.PlainTextBuilder"

Upvotes: 1

Novren
Novren

Reputation: 69

This is most likely an HTTP page being returned by the laravel endpoint you've defined at the end. I recommend you turn on Wire logging via the config tab in the carbon console to see what exactly is being returned by the endpoint.

Upvotes: 1

Related Questions