Question

Ashish here again.

I have developed a route which parses incoming SOAP request and logs some of information from the request. I used headers and XPATH for fetching information from SOAP service request. The route successfully parse and logs appropriate information.

The route is as follows:

 <route streamCache="true">

        <from uri="<some URI>"/>  

        <setHeader headerName="SOAPAction">
            <constant>http://www.something.com/constant>
        </setHeader>

         <setHeader headerName="actionId">
            <xpath resultType="java.lang.String">//ws:actionId/text()</xpath>
          </setHeader>


    <choice>

            <when>
                <xpath>//ws:actionId = '1'</xpath>
                <to ref="callService" />                   
            </when>

            <otherwise>

                <log message="Wrong Action ID : ${in.headers.actionId}" 
                          loggingLevel="ERROR"/>                  

            </otherwise>   

        </choice>

    </route>

As per logic the route must redirect to callService URI if actionId is 1, otherwise it should log wrong action Id without any response.

The logic works if actionId is 1, it redirects to callService and sends appropriate response to caller. If actionId is other than 1, it writes the log about wrong action Id with action Id but it sends the same request as response to the caller.

I checked it using soapUI and Java Socket Programming.But output is same, logs the actionId accurately but sends the same request as response to the caller.

I don't want same request as response. Response must be blank.

Can anybody help me to find the solution.

Regards,

Ashish

Was it helpful?

Solution

You need to set the response to empty or what empty means for you in that situation as well. And the response needs to fit the WSDL contract what the response can be.

So in the otherwise add code to set the empty response For example something a like:

<otherwise>
    ...
    <transform>
      <constant>NO DATA</constant>
    </transform>
 </constant>

Though also mind if you use camel-cxf then the dataFormat option can affect how an empty response should be created.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top