在WebService中捕获完整XML [英] Capture Full XML in WebService

查看:133
本文介绍了在WebService中捕获完整XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Web服务中捕获完整的XML。但是当我尝试在Fiddler中发帖时,我收到500内部服务器错误。我想念的是什么?



WebService -



I have try to capture full XML in web service. But I got 500 Internal Server Error while try to post in Fiddler. What I miss in this?

WebService -

[WebMethod]
     public XmlDocument XML(XmlDocument xmlDoc)
     {
         XmlDocument x = new XmlDocument();
         x = xmlDoc;
         return xmlDoc;
     }





申请机构 -





Request Body -

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <XML xmlns="http://tempuri.org/">
      <xmlDoc>string</xmlDoc>
      <number>96</number>
    </XML>
  </soap:Body>
</soap:Envelope>







POST http://localhost:50710/Service1.asmx?op=XML HTTP/1.1
POST /Service1.asmx HTTP/1.1: 
Host: localhost:50710
Content-Type: text/xml; charset=utf-8
Content-Length: 367
SOAPAction: "http://tempuri.org/XML"

推荐答案

首先,你的方法毫无意义。前两行什么都不做;他们的结果被忽略了。您只需返回输入时提供的相同对象。



-SA
To start with, your method makes no sense at all. First two lines do nothing; their result is ignored. You simply return the same object supplied on input.

—SA


这篇关于在WebService中捕获完整XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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