本文介绍了WSE 3.0无法将字符串类型序列化为转义的CDATA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我知道我应该使用WCF。&NBSP; 但是,我正在利用Omniture提供的服务,因为Omniture的WSDL定义和服务端点存在我无法控制的兼容性问题,因此只能与WSE 3.0一起使用。   虽然我能够解决Omniture的许多兼容性问题但是那里是一个仍然让我心痛的问题。  当通过WSE3.0传递字符串值时,Microsoft.Web.Services3.WebServicesClientProtocol类对如下所示的"脚本"编码值进行编码。论点。   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < soap:Body soap:encodingStyle =" http://schemas.xmlsoap.org/soap/encoding/">      &NBSP; < tns:ProductSubmitProductScript>       < productCode xsi:type =" xsd:string"> 123456789< / productCode>       < script xsi:type =" xsd:string">& lt; genesis& gt;& lt; / genesis& gt;< / script> &NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < / tns:ProductSubmitProductScript>    不幸的是,这种编码不会被Omniture迅速拒绝,因为xml值后来没有被解码。  当将字符串值传递给Omniture时,它们必须包含在转义序列中<![CDATA []]>。  因此,先前的请求应该在网上发送         < soap:Body soap:encodingStyle =" http://schemas.xmlsoap.org/soap/encoding/">      &NBSP; < tns:ProductSubmitProductScript>       < productCode xsi:type =" xsd:string"> 123456789< / productCode>       < script xsi:type =" xsd:string"><![CDATA [< genesis>< / genesis>]]>< / script> &NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < / tns:ProductSubmitProductScript>   我该如何处理?  构建我自己的SOAP请求并将其发布到WSE之外? Chris Felpel 博客:http://www.yahoogler .com 电子邮件:[email protected] 解决方案 这是和你一样的问题。我希望它有所帮助。 输入HTML通信需要使用CDATA而不是& lt; [ http://forums.asp.net/p/1171196/1961746.aspx#1961746 ] 问候。 - Esteban Murchio。 如果他们提供帮助,请记得将答复标记为答案,如果他们没有提供任何帮助,请将其取消标记。 I know I should be using WCF.  HOWEVER, I'm utilizing services provided by Omniture that simply only work well with WSE 3.0 as Omniture's WSDL definitions and service endpoints have compatibility issues that are beyond my control. While I was able to solve a lot of my compatibility problems with Omniture but there is one issue that is still causing me a lot of heartburn.  When passing strings values through WSE3.0 the Microsoft.Web.Services3.WebServicesClientProtocol class encodes the values as denoted below for the "script" argument.        <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">      <tns:ProductSubmitProductScript>      <productCode xsi:type="xsd:string">123456789</productCode>      <script xsi:type="xsd:string">&lt;genesis&gt;&lt;/genesis&gt;</script>      </tns:ProductSubmitProductScript>  Unfortunately, this encoding isn't going is promptly rejected by Omniture because the xml values are not subsequently decoded on their side.  When passing string values to Omniture they MUST be enclosed in the escape sequenice <![CDATA[ ]]>.  Thus, the prior request should be sent down the wire as        <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">      <tns:ProductSubmitProductScript>      <productCode xsi:type="xsd:string">123456789</productCode>      <script xsi:type="xsd:string"><![CDATA[<genesis></genesis>]]></script>      </tns:ProductSubmitProductScript> How would/should I handle this?  Construct my own SOAP request and post it outside WSE?Chris FelpelBlog: http://www.yahoogler.comEmail: [email protected] 解决方案 Hi,Here is some issue just like yours.I hope it helps.input HTML commment needs to with CDATA instead of &lt;[http://forums.asp.net/p/1171196/1961746.aspx#1961746]Regards.-Esteban Murchio.Please remember to mark the replies as answers if they help and unmark them if they provide no help. 这篇关于WSE 3.0无法将字符串类型序列化为转义的CDATA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-29 20:05