【发布时间】:2012-12-14 17:58:52
【问题描述】:
我正在从soap UI 发布下面的消息,并且我总是在网络服务中收到空值。无论我从soap UI 发布什么消息,它都只作为null。
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
Test
</env:Body>
</env:Envelope>
下面是我的简单WebService
[WebService(Namespace = "http://test.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class TestService : System.Web.Services.WebService {
[WebMethod]
public int TestMethod(string message)
{
try
{
File.WriteAllText("D:\\abc.xml", message);
return 0;
}
catch (Exception ex)
{
return 1;
}
}
}
【问题讨论】:
-
那是错误的 SOAP。您确定将更新的 WSDL 传递给了 soapUI?
-
约翰 - 感谢您的回复。错误的 SOAP 是什么意思?我只将正确的 WSDL 传递给soapUI
-
我从未见过带有这样消息的 WSDL。我不相信您通过了正确的 WSDL。
-
John - 根据我上面的代码,我刚刚创建了一个具有一种测试方法的 Web 服务。要测试来自soap Ui的代码,我会发送消息,如上所示。我在服务中得到空值....正确的 WSDL 是什么意思?能否请您详细说明一下。
-
我不相信从您正在显示的服务生成的 WSDL 会导致soapUI 发送您正在显示的消息。我认为在
<soap:Body>标签中直接包含文本甚至是无效的。
标签: c# asp.net web-services asmx