如何使用“发送请求到soap web服务”;截击图书馆“;在android中
我正在尝试使用Volley库与我的Soap Web服务通信。 搜索后,我只得到了与url通信的响应,但我没有 知道如何向soap web服务发送请求,该服务具有url、命名空间和web地址 方法名等,我还必须发送参数和请求以获得响应, 这里我有一个只基于url发送请求的示例如何使用“发送请求到soap web服务”;截击图书馆“;在android中,android,web-services,soap,android-volley,Android,Web Services,Soap,Android Volley,我正在尝试使用Volley库与我的Soap Web服务通信。 搜索后,我只得到了与url通信的响应,但我没有 知道如何向soap web服务发送请求,该服务具有url、命名空间和web地址 方法名等,我还必须发送参数和请求以获得响应, 这里我有一个只基于url发送请求的示例 String url = "http://httpbin.org/html"; // Request a string response StringRequest stringRequest = new StringRe
String url = "http://httpbin.org/html";
// Request a string response
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Result handling
System.out.println(response.substring(0,100));
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Error handling
System.out.println("Something went wrong!");
error.printStackTrace();
}
});
// Add the request to the queue
Volley.newRequestQueue(this).add(stringRequest);
我想使用volley library请求soap web服务,但我不知道如何使用volley library请求此类soap web服务,有人可以帮助我吗?提前谢谢。不确定这是否有帮助。但是看看这里。你找到解决办法了吗?我还想使用volley实现soap不,我没有找到任何解决方案。我认为volley是专门为处理REST而设计的。不确定这是否有帮助。但是看看这里。你找到解决办法了吗?我还想使用volley实现soap不,我没有找到任何解决方案。我认为volley是专门为处理REST而设计的。
public static String invokecreatepostfm(int posttypeid, byte[] picture,byte[] Fullimage,long postedbyid,String postcontent,String langitude,String latitude,String locationname,String webMethName, Context mContext) {
// Create request
SoapObject request = new SoapObject(NAMESPACE, webMethName);
SOAP_ACTION = NAMESPACE + webMethName;
// Property which holds input parameters
request.addProperty("PostTypeID", posttypeid);
request.addProperty("Picture", org.kobjects.base64.Base64.encode(picture));
request.addProperty("FullImage", org.kobjects.base64.Base64.encode(Fullimage));
request.addProperty("PostedByID", postedbyid);
request.addProperty("PostContent", postcontent);
request.addProperty("Langitude", langitude);
request.addProperty("Latitude", latitude);
request.addProperty("LocationName", locationname);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
LStatus = response.toString();
} catch (Exception e) {
e.printStackTrace();
LStatus = e.toString();
}
//Return booleam to calling object
return LStatus;
}