// 调用的方法名称 String methodName = "InsertMarkbyProperty"; // SOAP Action String soapAction = nameSpace + methodName; // 指定WebService的命名空间和调用的方法名 SoapObject rpc = new SoapObject(nameSpace, methodName); rpc.addProperty("name", name1); rpc.addProperty("sex", sex1);//******//设置需要调用weibservice接口的参数 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);生成调用WebService方法调用的soap信息,并且指定Soap版本
envelope.bodyOut = rpc; envelope.dotNet = true;// 是否调用DotNet开发的WebService
envelope.setOutputSoapObject(rpc); new MarshalBase64().register(envelope); HttpTransportSE ht = new HttpTransportSE(strURL);//HttpTransport构造函数的参数含义为: strURL – 要投递SOAP数据的目标地址,
ht.debug = true; ht.call(soapAction, envelope); // 获取返回的数据 Object object = envelope.getResponse(); return Integer.parseInt(object.toString());} catch (Exception e){ e.printStackTrace(); return -1;}
ksoap调用webservice
最新推荐文章于 2021-03-02 04:59:04 发布