How to disable a body data getting encoded in soap, retrofit request

后端 未结 1 661
無奈伤痛
無奈伤痛 2021-01-14 10:13

I have a request data where one of the element takes xml as value. While sending the data to the server using @Body my inner xml is getting encoded(html enc

相关标签:
1条回答
  • 2021-01-14 10:23

    I have found it by myself.

    Here is what I'm doing, I have removed enclosing the inner xml inside CDATA so that in server side it can take and decode the inner xml before processing.

    If we enclose the inner xml with CDATA it won't decode the string and it make service to fail.

    Here is my final request:

    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/soap/envelope/">
       <soap12:Body>
          <UpdateASN xmlns="http://tempuri.org/">
             <SecureCode>VkdWelkyOUJVMDQ9</SecureCode>
             <strXML>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;NewDataSet&gt;&lt;Table&gt;&lt;ASNId&gt;21131248&lt;/ASNId&gt;&lt;ASNLineId&gt;108069195&lt;/ASNLineId&gt;&lt;EANOCC&gt;5051622303470&lt;/EANOCC&gt;&lt;TUQuantityRecevied&gt;2&lt;/TUQuantityRecevied&gt;&lt;ItemDescription&gt;sample 6X300ML&lt;/ItemDescription&gt;&lt;TUSize&gt;6&lt;/TUSize&gt;&lt;TUDespatched&gt;1&lt;/TUDespatched&gt;&lt;/Table&gt;&lt;/NewDataSet&gt;</strXML>
          </UpdateASN>
       </soap12:Body>
    </soap12:Envelope>
    
    0 讨论(0)
提交回复
热议问题