android连接wcf问题求大神解决
public class HelloService implements ISoapService{
private static final String NameSpace = "http://tempuri.org/";
private static final String URL = "http://192.168.1.86:80/AndroidService.svc";
private static final String SOAP_ACTION = "http://tempuri.org/fnTest";
private static final String MethodName = "fnTest";
private static HelloService HomeLinkManager;
public static HelloService getInstance() {
if (HomeLinkManager == null) {
HomeLinkManager = new HelloService();
}
return HomeLinkManager;
}
public HelloService() {
}
public SoapObject LoadResult() {
SoapObject request = new SoapObject(NameSpace, MethodName); // example方法中有一个String的参数,这里将“android client”传递到example中
request.addProperty("inputCommand", "oh"); // 获得序列化的Envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true; envelope.bodyOut = request; // Android传输对象
HttpTransportSE transport = new HttpTransportSE(URL);
transport.debug = true; // 调用WebService
try { transport.call(SOAP_ACTION, envelope);
}
catch (IOException e) { // TODO Auto-generated catch block
e.getMessage();
}
catch (XmlPullParserException e) { // TODO Auto-generated catch block
e.getMessage(); } try {
if (envelope.getResponse() != null) {
envelope.bodyIn.toString(); }
} catch (SoapFault e) { // TODO Auto-generated catch block
e.getMessage(); }
SoapObject result = (SoapObject) envelope.bodyIn;
//System.out.println(result.toString());
//SoapObject result =(SoapObject) envelope.getResponse();
return result;
}
网上复制过来的代码使用,但是执行到 transport.call(SOAP_ACTION, envelope); 就会报错,说http404,但是我明明在iis里面可以访问地址的啊!弄了2天都不知哪里有问题请问有大神回答吗