SoapFault - error: "ns1: unexpected error" android SOAP call

I am trying to call a SOAP web service using a single WSDL file.

I added all the necessary parameters to it. But I get an error as shown below:

SoapFault - faultcode: 'ns1:unexpected-error' faultstring: 'Fault occurred while processing.' faultactor: 'null' detail: null in android 

Here is my sample code:

 class RegisterMember extends AsyncTask<Void, Void, Void> { String SOAP_ACTION = ""; String METHOD_NAME = "registerMember"; String NAMESPACE = "http://XXXXX.XX"; String URL="http://XXXX.XX?WSDL"; SoapPrimitive result1; String str; @Override protected void onPreExecute() { mProgressDialog = new ProgressDialog(MainActivity.this); mProgressDialog.setMessage("Checking For Activation"); mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { try { StringBuffer sb; SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("name", "XXXX"); request.addProperty("email", "XXXX@gmail.com"); request.addProperty("username", "XXXXX"); request.addProperty("password", "XXXX"); request.addProperty("mobile", "XXXXXXX"); request.addProperty("pin", "XXXX"); request.addProperty("dob", "XX/XX/XXXX"); request.addProperty("gender", "male"); request.addProperty("address", "XXXXX"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet=true; envelope.setOutputSoapObject(request); envelope.bodyOut = request; Log.d("In try","In Try"); HttpTransportSE ht = new HttpTransportSE(URL); ht.call(NAMESPACE+METHOD_NAME, envelope); Log.d("In try","In Try1"); result1 = (SoapPrimitive)envelope.getResponse(); //SoapObject resultObj = (SoapObject)envelope.getResponse(); /*int numProp = resultObj.getPropertyCount(); sb = new StringBuffer(); for(int jj=0; jj<numProp; jj++) { sb.append((String) resultObj.getProperty(jj) + "\n"); Log.d("For Loop", String.valueOf(sb.append((String) resultObj.getProperty(jj)))); }*/ Log.d("Envelope", String.valueOf(result1)); // str = envelope.getResponse(); // status= Boolean.valueOf(result1.toString()); // str = result1.toString(); Log.w("String Response of CheckActivation Status - - - - - - - - - -", str); Log.w("CheckActivation Status - - - - - - - ->>>>>>>>>", String.valueOf(result1)); } catch (Exception e) { Log.d("No Data Found",e +""); } try { Thread.sleep(1000); } catch(Exception ex) { } return null; } @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); Log.d("Response = = = = =",String.valueOf(result)); mProgressDialog.dismiss(); } } 

I doubt SOAPACTION can cause problems. Is this possible if we have SOAPACTION empty and we call a web service?

I used the same code for another web service with the .svc url and it works fine, so I don't think the code should have any problems.

SOAP version: 1.1 ksoap library version: ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar

Any help is appreciated.

thanks

+8
android soap soapfault
source share
2 answers

Try replacing result1 = (SoapPrimitive)envelope.getResponse(); on

 result1 = (SoapPrimitive)envelope.bodyIn(); 

and also set SOAP_ACTION!
You also add a property to the request:

  PropertyInfo pi = new PropertyInfo(); pi.name = NAME; pi.type = String.class; request.addProperty(pi, VALUE); 
+1
source share

You need to check if SOAP wsdl has style, document or RPC.

both have different WSDL formats, and if you try to call WSDL with a document type, you may not respond to the same code for the other.

Therefore, please cross-check this and confirm.

Hi

0
source share

All Articles