简体   繁体   中英

Asp.net webservice always recieving null values from soap ui

I'm posting below message from soap UI and i always receiving null value in webservice. Whatever message I'm posting from soap UI it is taking as null only.

<?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>

Below is my simple 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;
        }
    }
}

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM