How to solve this SonicESB.REST.Fault? - Bad Request (Invali

Posted by ritesh.kar on 12-Dec-2011 14:12

Dear Friends,

I'm a beginner, learning Sonic ESB, started with Sonic ESB 7.5 and progressed to Sonic ESB 8.0.

I've a systems-integration scenario whereby system (A) has to invoke an RESTful ESB process. This process has to enrich information from external system (B) that implements RESTful API.

I'm using Sonic Connect Service to "expose" the ESB process as a RESTful web-serivce. This process has a STEP (SubProcess) that uses Sonic Connect Service to "invoke" the external API as a RESTful client.

I'm facing a strange problem whereby the process works fine when I invoke it with a Workbench scenario. But the same process fails when I invoke this process via its RESTful interface. On closer analysis, it seems the Sonic Connect Service STEP fails to invoke the external RESTful API - giving a SonicESB.Rest.Fault - StatusCode=400; Bad Request (Invalid Header Name)

On further analysis, I found the following headers that this STEP is trying to interpret and fails. In particular, I think this header is the invalid name - seems like some placeholder replacement didn't happen.   <header  name="{http://www.sonicsw.com/esb}ReplyTo">ENDPOINT:RESTfulESBProject.Connect.AsynchTmp</header>

Please can anyone help me to configure the ESB process that will work and if my hunch is correct, how to solve it. NB: I'm using Sonic ESB 8.0 - "Sonic Connect Service"

Thank you for your time and appreciate your help.

Here is the rest of the tracker message:

<SOAP-ENV:Envelope SOAP-ENC:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        xmlns:rpc="http://www.sonicsw.com/sonicxq/rpc">
    <SOAP-ENV:Body>
        <xq:trackingMessageInfo event="SERVICE_ENTRY" id="ID:enrichDataProcess:localhost:1323719978282" timestamp="1323719978438"
                xmlns:xq="http://www.sonicsw.com/sonicxq">
            <trackingLocation container="dev_ESBTest" host="localhost" process="invokeRESTAPISubProcess" serviceApplication="ESBToAPIConnect" step="invokeRESTAPISubProcess:invokeAPIStep" topLevelProcess="enrichDataProcess"/>
            <xqMessageHeaders>
                <header name="JMSCorrelationID">RESTfulESBProject:1323717557125:1:</header>
                <header name="JMSRedelivered">false</header>
                <header name="JMSReplyTo">RESTfulESBProject.Connect.AsynchTmp</header>
                <header name="JMS_SonicMQ_ExtendedType">x-sonicmq-multipart</header>
                <header name="JMS_SonicMQ_XQ.isMultipart">true</header>
                <header name="Accept">text/xml</header>
                <header name="BaseURL">http://localhost:3581/RESTfulAPIApp</header>
                <header name="FINAL_MATCH_GROUP">/</header>
                <header name="Method">GET</header>
                <header name="URITemplate">/RESTfulAPIApp/resource/{paramId}</header>
                <header name="URL">http://localhost:3581/RESTfulAPIApp/resource/46efd774-d9cf-42db-bea6-5d32d1a0a5e0</header>
                <header name="asyncReplyForDestinaton">enrichDataProcess:PROCESS</header>
                <header name="paramId">46efd774-d9cf-42db-bea6-5d32d1a0a5e0.xml</header>
                <header name="{http://www.sonicsw.com/esb}ReplyTo">ENDPOINT:RESTfulESBProject.Connect.AsynchTmp</header>
            </xqMessageHeaders>
        </xq:trackingMessageInfo>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

All Replies

Posted by wtam on 12-Dec-2011 14:32

Please give the following a try. 

Edit the spring.xml file of the Sonic Connect service that exposes the ESB process.

Add the following header filter to your "ExposeHeaderFilterStrategy.Resource.*" bean.

       
           

                {http://www.sonicsw.com/esb}ReplyTo

           

       

Save the spring.xml and rebuild/upload the SC service. 

Posted by ritesh.kar on 12-Dec-2011 16:59

Thank you William, that was a prompt and great reply.

I made the change and it worked with a small technical correction: I'd to make the change in the InvokeHeaderFilterStrategy for the Sonic Connect Service acting as a consumer of the RESTful API in my scenario. Thanks, that also helped me to understand the spring.xml a lot better.

Regards,

Ritesh

This thread is closed