0

我正在从肥皂 UI 发布下面的消息,并且我总是在 web 服务中收到空值。无论我从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;
        }
    }
}
4

1 回答 1

0

You're not specifying which method to call or the parameters of that method in your body. You'll need something like this:

<env:Body>
  <m:TestMethod xmlns:m="http://tempuri.org">
    <message>Test</message>
  </m:TestMethod>
</env:Body>
于 2012-12-14T18:17:37.183 回答