0

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

рüффп
  • 5,172
  • 34
  • 67
  • 113
Ashish Nijai
  • 321
  • 2
  • 13

1 Answers1

0

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.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Thanks again... I used your suggestion for setting the response and it works. I forgot to ask the real thing in my post. Why the request is returned as response? I want to know the real cause of response return. When I didn't used headers, the request was not returned as response. Is it returned due to use of Headers? Please answer my question... – Ashish Nijai Jan 04 '13 at 09:03