简体   繁体   English

如何将 CDATA 参数包含到 C#soap 调用中

[英]How to include CDATA parameter into a C# soap call

I have a soap client and in order to make a call to a service of my company I need, among others, a parameter containing a CDATA string.我有一个肥皂客户端,为了调用我公司的服务,我需要一个包含 CDATA 字符串的参数。

Simple version of the C# code I have is the following:我拥有的 C# 代码的简单版本如下:

ServiceRef.GetArraySoapClient client = new ServiceRef.GetArraySoapClient();

String codes = @"
<Codes>
  <Code><Batch>AAA</Batch><Item>YYY</Item></Code>
  <Code><Batch>BBB</Batch><Item>XXX</Item></Code>
</Codes>";

client.GetArray("uname", "pword", "<![CDATA[" + codes + "]]>");

When I did the same using SoapUI, it works.当我使用 SoapUI 做同样的事情时,它起作用了。 But within the C# code, it gives me an error that goes like "error in the format of Code items".但是在 C# 代码中,它给了我一个类似于“代码项格式错误”的错误。

I don't understand what is wrong with defining CData like this?我不明白这样定义 CData 有什么问题?

好的,显然我不需要在发送请求时在“代码”之前和之后添加一些特殊的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM