使用kso​​ap2的WCF Web服务的Android - 错误SoapFault - faultcode:'a:ActionNotSupported'

jan*_*han 5 wcf android ksoap2

我做了一个简单的项目,使用kso​​ap2调用wcf web服务.但是当它调用envelope.getResponse(); 它给错误说-----

"SoapFault - faultcode:'a:ActionNotSupported'faultstring:'由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理带有Action'GetString'的消息.这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配.检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无).faultactor:'null'detail:null"

我在localhost中运行web服务.

请帮帮我一些

我指定的这个值是否正确,

private static final String SOAP_ACTION = “GetString”;
private static final String OPERATION_NAME = “GetString”;
private static final String WSDL_TARGET_NAMESPACE = “http://tempuri.org/”;
private static final String SOAP_ADDRESS = “http://10.0.2.2:14089/Service1.svc?wsdl”;
Run Code Online (Sandbox Code Playgroud)

Lad*_*nka 11

我们不知道这些值是否正确 - WSDL应该告诉您调用GetString操作的正确SOAP操作是什么.

在Web浏览器中打开WSDL(这是您要分配的地址SOAP_ADDRESS)并找到类似的内容:

<wsdl:binding name="..." type="...">
  ...
  <wsdl:operation name="GetString">
     <soap:operation soapAction="HERE_IS_CORRECT_ACTION" />
     <wsdl:input>...</wsdl:input>
     <wsdl:output>...</wsdl:output>
  </wsdl>
  ...
</wsdl:binding>
Run Code Online (Sandbox Code Playgroud)

顺便说一句.当您调用该服务时,您应该使用不带?wsdl查询字符串的URL .