我正在尝试从android应用程序向soap服务发出请求,代码是这样的。 它给我的错误是在调用之后出现的,该消息已经带有以下消息:“服务器无法处理请求。--->无法读取DSSubexploitation --->过程或函数'P_BDGX_Encuestas_Obtener_Recorrido'我正在等待未指定的@comcomarca参数。 但是如果参数正在发生,那么这两个是必需的,我将soapUI捕获为如果返回数据 谢谢您,我的英语不好enter image description here
public class MainActivity extends Activity {
private final String NAMESPACE_M = "http://EINFOSAGEX/WebServices/";
private final String URL_M = "http://pruwseinfosagex.gobex.pri/WSSincroniza.asmx";
private final String SOAP_ACTION_M = "http://EINFOSAGEX/WebServices/ObtenerRecorrido";
private final String METHOD_NAME_M = "ObtenerRecorrido";
private final String NAMESPACE_ObtEnc = "http://EINFOSAGEX/WebServices/";
private final String URL_ObtEnc = "http://pruwseinfosagex.gobex.pri/WSSincroniza.asmx";
private final String SOAP_ACTION_ObtEnc= "http://EINFOSAGEX/WebServices/ObtenerEncuesta";
private final String METHOD_NAME_ObtEnc = "ObtenerEncuesta";
private String TAG ="LOG_AsyncTask";
AsynCallWS task = new AsynCallWS();
ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnClick = (Button) findViewById(R.id.bntClick);
btnClick.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
task.execute();
}
});
}
private class AsynCallWS extends AsyncTask<Void,Void,Void>{
@Override
protected void onPostExecute(Void result) {
Log.i(TAG, "onPostExecute");
}
@Override
protected void onPreExecute() {
Log.i(TAG, "onPreExecute");
}
@Override
protected Void doInBackground(Void... voids) {
Log.i(TAG, "doInBackground");
//dialog.show();
callWebserviceObtenerRecorrido();
//callWebserviceObtenerEncuesta();
return null;
}
}
public void callWebserviceObtenerRecorrido() {
//dialog.show();
// Modelo el request
SoapObject request = new SoapObject(NAMESPACE_M, METHOD_NAME_M);
request.addProperty("idComarca","idComarca", 1004); // Paso parametros al WS
//request.addAttribute("idComarca", 1004);
request.addProperty("anio", "anio",2017); // Paso parametros al WS
//request.addAttribute("anio", 2017);
PropertyInfo stringArrayPropertyInfo = new PropertyInfo();
// Modelo el Sobre
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope .dotNet = true;
envelope .setOutputSoapObject(request);
// Modelo el transporte
HttpTransportSE transporte = new HttpTransportSE(URL_M);
transporte.debug = true;
Object response = null;
try {
// Llamada
transporte.call(SOAP_ACTION_M, envelope );
String result =
envelope.getResponse().toString();
// Resultado
SoapPrimitive resultado = (SoapPrimitive) envelope .getResponse();
Log.i("Resultado", resultado.toString());
}catch (NullPointerException e) {
Log.e("NullPointerException", e.getMessage());
response = e.toString();
} catch (Exception pe) {
Log.e("ERROR", pe.getMessage());
response = pe.toString();
}
}
public void callWebserviceObtenerEncuesta() {
//dialog.show();
// Modelo el request
SoapObject request = new SoapObject(NAMESPACE_ObtEnc, METHOD_NAME_ObtEnc);
//request.addProperty("idComarca", 1004); // Paso parametros al WS
//request.addAttribute("idComarca", 1004);
//request.addProperty("anio", 2017); // Paso parametros al WS
//request.addAttribute("anio", 2017);
// Modelo el Sobre
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope .dotNet = true;
envelope .setOutputSoapObject(request);
// Modelo el transporte
HttpTransportSE transporte = new HttpTransportSE(URL_ObtEnc);
Object response = null;
try {
// Llamada
transporte.call(SOAP_ACTION_ObtEnc, envelope );
String result =
envelope.getResponse().toString();
// Resultado
SoapPrimitive resultado = (SoapPrimitive) envelope .getResponse();
Log.i("Resultado", resultado.toString());
}catch (NullPointerException e) {
Log.e("NullPointerException", e.getMessage());
response = e.toString();
} catch (Exception pe) {
Log.e("ERROR", pe.getMessage());
response = pe.toString();
}
}
private void setupProgressDialog() {
}
}