没有有效的操作参数,无法处理请求。请提供有效的 SOAP 操作。
zhuyc 2015-02-05 04:45:51 最近在模拟一个webservice接受soap请求,出问题了,麻烦给看看。
请求:
<?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:Header>
<HTNGHeader xmlns="http://htng.org/1.1/Header/">
<From>
<Credential>
<userName>fdasdfafs</userName>
<password>123131</password>
</Credential>
</From>
</HTNGHeader>
</soap:Header>
<soap:Body>
<MYTEST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.opent.org/2003/05">
<POS>
<Source>
</Source>
</POS>
<AvailRequestSegments xmlns="http://www.opent.org/2003/05"><AvailRequestSegment>
</AvailRequestSegment>
</AvailRequestSegments>
</MYTEST>
</soap:Body>
</soap:Envelope>
webservice代码:
namespace fdafdafaf.fdafda
{
public class HTNGHeader : SoapHeader
{
public string Username{ get; set; }
public string Password { get; set; }
}
public class mytest
{
public HTNGHeader myheader;
[WebMethod]
[SoapHeader("myheader", Direction = SoapHeaderDirection.In)]
public string fdasfsda()
{
return this.GetResponseByName("fdsafd", "fsdaf");
}
}
}
运行后拿此请求请求提示:
System.Web.Services.Protocols.SoapException: 没有有效的操作参数,无法处理请求。请提供有效的 SOAP 操作。
在 System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()
在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
这问题怎么解决呢?