doudi2005 2010-02-25 05:06
浏览 100
已采纳

在SOAP响应中包含XML

In my WSDL my reponse I have it setup to be like this:

<message name='getPartsResponse'>
  <part name='Result' type='xsd:string'/>
</message>

The problem I am having is that what I am sending in the response is XML and not an string. As a result of this I am getting the XML of the response (not the XML SOAP Response (that is ok)) with HTML entities instead of the < and > XML has.

This is what I get:

<SOAP-ENV:Body>
<ns1:getPartsResponse>
<Result xsi:type="xsd:string">
&lt ;catalog&gt ;
&lt ;result id="1"&gt ;
&lt ;part&gt ;AAAAAAAAAAA&lt ;/part&gt ;
&lt ;qty>0000000000&lt ;/qty&gt ;
&lt ;mfg&gt ;XXXXXXXXXXXXX&lt ;/mfg&gt ;
&lt ;/result&gt ;
&lt ;result id="2"&gt ;
&lt ;part&gt ;BBBBBBBBBBB&lt ;/part&gt ;
&lt ;qty>11111111111&lt ;/qty&gt ;
&lt ;mfg&gt ;ZZZZZZZZZZZZZ&lt ;/mfg&gt ;
&lt ;/result&gt ;
&lt ;/catalog&gt ;
</Result>
</ns1:getPartsResponse>
</SOAP-ENV:Body>

And this is what I want to get:

<SOAP-ENV:Body>
<ns1:getPartsResponse>
<Result xsi:type="xsd:string">
<catalog>
<result id="1">
<part>AAAAAAAAAAA</part>
<qty>0000000000</qty>
<mfg>XXXXXXXXXXXXX</mfg>
</result>
<result id="2">
<part>BBBBBBBBBBB</part>
<qty>11111111111</qty>
<mfg>ZZZZZZZZZZZZZ</mfg>
</result>
</catalog>
</Result>
</ns1:getPartsResponse>
</SOAP-ENV:Body>

What am I missing?

Thank you.

  • 写回答

3条回答 默认 最新

  • dtp0760 2010-02-27 21:45
    关注

    Unless the schema for the service describes exactly the XML you are trying to send, you have to use XML escapes to make your XML pass through the pipe as a string. &lt;tag&gt; instead of <tag>, etc, etc, etc.

    Or, you need to change the schema to use an XML schema any particle.

    If this is all new to you, I recommend downloading a distribution of Apache CXF. Look at the 'wsdl-first' examples and see how the schema is integrated.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?