如何在SOAP请求中包含XML标记

时间:2012-01-12 10:05:19

标签: xml soapui

我有一个简单的SOAP请求,如下所示

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.bayer.com/" xmlns:chim="http://scivantage.com/tata">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:strategy>
         <request>
            <xmlMessage>?</xmlMessage>
          </request>
      </ser:strategy>
   </soapenv:Body>
</soapenv:Envelope>

在上面的简单SOAP请求中 在xmlMessage标签中,我需要包含以下XML数据

<accountid>384</accountid>
<userid>testuser</userid>

请告诉我如何在问号中包含这两个标签?

1 个答案:

答案 0 :(得分:1)

您可以使用CDATA(未解析文本)并在客户端上重新解析xmlMessage。参见:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.bayer.com/" xmlns:chim="http://scivantage.com/tata">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:strategy>
         <request>
            <xmlMessage><![CDATA[<accountid>384</accountid><userid>testuser</userid>]]>/xmlMessage>
          </request>
      </ser:strategy>
   </soapenv:Body>
</soapenv:Envelope>