1 Reply Latest reply on Mar 6, 2014 3:15 AM by Claus Ibsen

    camel cxf - can't escape spaces correctly

    Alex Terzis Newbie

      I'm trying to access a public API with the cxf component from within a camel flow; the URL contains spaces in it (it's a Microsoft-based platform) and I can't seem to be able to escape %20 correctly in the URL:

       

      <to uri="cxf://http://<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS%20UK%20Ltd./Codeunit/EMS2NAV?wsdlURL=src/main/resources/META-INF/EMS2NAV.wsdl&amp;serviceName={urn:microsoft-dynamics-schemas/codeunit/EMS2NAV}EMS2NAV&amp;portName={urn:microsoft-dynamics-schemas/codeunit/EMS2NAV}EMS2NAV_Port&amp;dataFormat=MESSAGE"/>

       

      I've trying using '%20' or even '%2520' instead of '%20" with no luck!

      For all of the above I keep getting a "400 Bad Request" from the service, while I do observe with Wireshark that the outgoing request (that camel generates) contains actual spaces (instead of %20)!

       

      It seems like somewhere in the camel code, the decoding takes place and there is no way to have camel to generate the call with the '%20' (so that I avoid the 400 error).

       

      Any ideas on how to successfully escape the above URL?

       

      -----------

      To make things clear:

       

      The following request from SoapUI works fine:

      http://<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS%20UK%20Ltd./Codeunit/EMS2NAV

       

      But (observing with Wireshark) I see that camel generates the following request that fails with 400 Bad Request error:

      http://<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS UK Ltd./Codeunit/EMS2NAV

      --------------------

      And to clarify even further, ALL of the following generate the same output request (that contains the actual spaces with no escaping whatsoever and) that returns the 400 Bad Request error:

       

      <to uri="cxf:/<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS%20UK%20Ltd./Codeunit/EMS2NAV?wsdlURL=

       

      <to uri="cxf://<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS%2520UK%2520Ltd./Codeunit/EMS2NAV?wsdlURL=

       

      <to uri="cxf://<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS%20UK%20Ltd./Codeunit/EMS2NAV?wsdlURL=

       

      <to uri="cxf://<XX.XX.XX.XX-deletedTheIPForSecurityReasons>:7047/nSembleR2_MN/WS/CRONUS%2520UK%2520Ltd./Codeunit/EMS2NAV?wsdlURL=