想要使用c#将Web服务(ASMX)肥皂请求对象(XML)保存到文件中 [英] Want to save the Web service(ASMX) Soap Request Object(XML) in to a file using c#

查看:68
本文介绍了想要使用c#将Web服务(ASMX)肥皂请求对象(XML)保存到文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要使用c#.net代码将基于Web方法名称的Web服务(ASMX)肥皂请求对象(XML)保存到文件中.

将SOAP 1.2请求XML保存为XML文件

请帮忙

问候,
Senthil S

Need to save the Web service(ASMX) Soap Request object(XML) in to a file based on web method name using c#.net code

save SOAP 1.2 Request XML as XML file

Please help

Regards,
Senthil S

推荐答案

通常,SOAP Request对象的格式为:

In general, SOAP Request object is formatted as:

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope

    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
     <GetCustomerInfo xmlns="http://SERVER/VDir/VName">
       <CustomerID>ABCDEF</CustomerID>
       <OutputParam />
     </GetCustomerInfo>
  </soap:Body>
</soap:Envelope>



为了读写这些xml元素,System.Xml.Linq命名空间的XDocument类用作:



To read and write these xml elements, XDocument class of System.Xml.Linq namespace is used as:

XDocument srcTree = new XDocument(
    new XComment("This is a comment"),
    new XElement("Root",
        new XElement("Child1", "data1"),
  )
};


这篇关于想要使用c#将Web服务(ASMX)肥皂请求对象(XML)保存到文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆