Forum Discussion

kiwi7's avatar
kiwi7
New Contributor
5 years ago

Error in building a soaprequest

There seems to be a bug in composing a soap request when text in the body containing certain characters. On a request we got back that the message was not wellformed. Looking at the raw request we see a kind of mixing up with two body elements. Deducing we found out it goes wrong when the text contains the following characters "{${". 

When we have a request like this in the xml-view:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oob="http://www.OOBCWS03.OOBI0103.Request.com">

   <soapenv:Header/>

   <soapenv:Body>

      <oob:OOBCWS03Operation>

         <oob:OOBCWS03Operatie>

            <oob:cgn_tekstuit_indi>xxx</oob:cgn_tekstuit_indi>

            <oob:tekstuiti>{${</oob:tekstuiti>

         </oob:OOBCWS03Operatie>

      </oob:OOBCWS03Operation>

   </soapenv:Body>

</soapenv:Envelope>

 

We see after the invoke in the raw-view, a kind of mixed up request:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oob="http://www.OOBCWS03.OOBI0103.Request.com">

   <soapenv:Header/>

   <soapenv:Body>

      <oob:OOBCWS03Operation>

         <oob:OOBCWS03Operatie>

            <oob:cgn_tekstuit_indi>xxx</oob:cgn_tekstuit_indi>

            <oob:tekstuiti>{<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oob="http://www.OOBCWS03.OOBI0103.Request.com">

   <soapenv:Header/>

   <soapenv:Body>

      <oob:OOBCWS03Operation>

         <oob:OOBCWS03Operatie>

            <oob:cgn_tekstuit_indi>xxx</oob:cgn_tekstuit_indi>

            <oob:tekstuiti>{${</oob:tekstuiti>

         </oob:OOBCWS03Operatie>

      </oob:OOBCWS03Operation>

   </soapenv:Body>

</soapenv:Envelope

 

As far as we know the characters {$ don't have a special meaning in XML, so it shouldn.t be a problem.

When we have a message with only "{$" (instead of "{${" ) the composing goes well:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oob="http://www.OOBCWS03.OOBI0103.Request.com">

   <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://www.OOBCWS03.OOBI0103.com/OOBCWS03Port/OOBCWS03OperationRequest</wsa:Action><wsa:MessageID>uuid:25baf000-fc16-4fb5-902a-bcad09970de9</wsa:MessageID><wsa:To>https://APMVST1.BELASTINGDIENST.NL:3304/OOBCWS03</wsa:To></soapenv:Header>

   <soapenv:Body>

      <oob:OOBCWS03Operation>

         <oob:OOBCWS03Operatie>

            <oob:cgn_tekstuit_indi>xxx</oob:cgn_tekstuit_indi>

            <oob:tekstuiti>{$</oob:tekstuiti>

         </oob:OOBCWS03Operatie>

      </oob:OOBCWS03Operation>

   </soapenv:Body>

</soapenv:Envelope>

 

The soapUI version we are using is 5.4.0. Are we doing something wrong or is this a bug?

Kind regards,

Iwan Mensink

  • kiwi7's avatar
    kiwi7
    5 years ago

    Thanks HimanshuTayal for your quick respons,

    Using /$ didn't help but you put me in right direction of escape characters, using $$ did the trick for me.

    Thanks again.

  • kiwi7 :

     

    Yes you are correct, character $ doesn't have any special meaning to XML but character $ have special meaning in soapui. You can use \ to escape the character.

     

    Hope it will help you to resolve the issue. 🙂

    • kiwi7's avatar
      kiwi7
      New Contributor

      Thanks HimanshuTayal for your quick respons,

      Using /$ didn't help but you put me in right direction of escape characters, using $$ did the trick for me.

      Thanks again.

      • richie's avatar
        richie
        Community Hero
        Hey@kiwi7,

        Sorry ive only just seen your post.

        Yeah the reason you was getting the error was cos soapui recognised the $ symbol as though you were using properties. Adding an extra $ symbol, so it reads $$ indicates to soapui that it isnt a property placeholder.
        Dunno why the xmlparser was reporting the error as malformed xml though, as $ characters in tag values is allowed. Actually dollar symbols in tagnames is allowed too....you just need to escape any of the 5 xml entities....ampersand(&), quote('), doublequote("), less than (<) and greater than (>)

        Ta

        Rich