如何将包含HTML的字符串发送到SOAP xml?

时间:2013-10-16 09:36:34

标签: xml web-services soap

如何在SOAP xml Web服务中传递字符串。我的字符串包含HTML格式。当我点击提交xml给我输出,但我无法检索数据。而不是字符串(而不是HTML)我得到了完美的回应。我的代码是,

string = @"<table class=\"\" style=\"width: 100%;\" cellspacing=\"0\" cellpadding=\"0\">"
 "        <tr>"
 "<td bgcolor=\"#7ea34b\" height=\"88\" style=\"padding-left: 10px; font-weight: bold; font-size: 10pt;color: #ffffff; font-family: Verdana\" align=\"center\">"
 "Book Your New Car @ <a href=\"http://www.test.com/\">www.test.com</a>"
 "or Call 123456789 <br />"
 "<a href=\"http://www.test.com//unsubscribe.aspx?email="
 "\">Click Here</a>"
"to Unsubscribe from this List" "</td></tr>"
"</table> </table>";

感谢您的帮助。

2 个答案:

答案 0 :(得分:3)

您需要在<![CDATA[ ... ]]>中包装HTML,以便string看起来像这样:

string = @"<![CDATA[<table class=\"\" style=\"width: 100%;\" cellspacing=\"0\" cellpadding=\"0\">"
 "        <tr>"
 "<td bgcolor=\"#7ea34b\" height=\"88\" style=\"padding-left: 10px; font-weight: bold; font-size: 10pt;color: #ffffff; font-family: Verdana\" align=\"center\">"
 "Book Your New Car @ <a href=\"http://www.test.com/\">www.test.com</a>"
 "or Call 1-888-284-4718<br />"
 "<a href=\"http://www.test.com//unsubscribe.aspx?email="
 "\">Click Here</a>"
"to Unsubscribe from this List" "</td></tr>"
"</table> </table>]]>";

答案 1 :(得分:0)

您可以在客户端将字符串编码为base64,然后在服务器端对其进行解码。这样您就不必担心引号了。