我创建了一个小应用来访问.Net Web服务
但我从Android
中收到此错误SoapFault - faultcode: 'soap:Client' faultstring: 'System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://webservice.pollsdb.com/Msgs.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)' faultactor: 'null' detail: org.kxml2.kdom.Node@b1ebfe80
有谁知道如何从android调用此服务?
这是我的代码
SOAP_ACTION = namespace + MethodName;
request = new SoapObject(namespace, MethodName);
//Adding String value to request object
request.addProperty("Lg", Lg);
request.addProperty("Lt", Lt);
request.addProperty("Cnt", Cnt);
//request.addProperty("ToUnit", "" + toUnit);
SetEnvelope();
//SOAP calling webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
//Got Webservice response
String result = envelope.getResponse().toString();
return result;
答案 0 :(得分:0)
我发现了问题 它出现在.Net而不是Android中 刚刚将名称空间从.Net default更改为服务所在的网站
[WebService(Namespace = "http://webservice.pollsdb.com/")]