Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to get response from a web service using KSoap
    primarykey
    data
    text
    <p>I am using Ksoap2 api for integrating the web services. The web services that require no input from user, are working fine.</p> <p>But in case of input it is giving SoapFault Exception. </p> <p>I am sharing the code here and details.</p> <p>I'm given a envelop string for this method:</p> <p>Article:</p> <pre><code>&lt;soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:def="http://DefaultNamespace"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;def:article soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;articleID xsi:type="xsd:double"&gt;$ARTICLEID&lt;/articleID&gt; &lt;/def:article&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>My code:</p> <pre><code>private String getNewsDetails() { String URL = "http://heinrich.house.gov/common/site/mobile.cfc?WSDL"; String NAMESPACE = "http://DefaultNamespace/"; String METHOD_NAME = "article"; String SOAP_ACTION = "http://DefaultNamespace/article"; SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME); request.addProperty("articleID", "590"); //590 or 592 etc... for test-case SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // envelope.dotNet = true; envelope.setOutputSoapObject(request); AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL); try { androidHttpTransport.call(SOAP_ACTION,envelope); resultsRequestSOAP = (SoapObject) envelope.bodyIn; Log.e("Response", "getNewsDetails..." + resultsRequestSOAP); return resultsRequestSOAP.toString(); } catch (IOException e) { Log.e("TAG","IOException...."+e); new AlertDialog.Builder(this).setTitle("Error") .setMessage(e.getMessage()).setPositiveButton("OK", null) .show(); } catch (XmlPullParserException e) { Log.e("TAG","XmlPullParserException...."+e); new AlertDialog.Builder(this).setTitle("Error") .setMessage(e.getMessage()).setPositiveButton("OK", null) .show(); } return null; } </code></pre> <p>Here is the response:</p> <pre><code>04-20 18:32:24.245: ERROR/AndroidRuntime(940): FATAL EXCEPTION: main 04-20 18:32:24.245: ERROR/AndroidRuntime(940): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.demo.view/com.demo.view.Demo}: java.lang.ClassCastException: org.ksoap2.SoapFault 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.os.Handler.dispatchMessage(Handler.java:99) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.os.Looper.loop(Looper.java:123) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.ActivityThread.main(ActivityThread.java:3647) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at java.lang.reflect.Method.invokeNative(Native Method) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at java.lang.reflect.Method.invoke(Method.java:507) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at dalvik.system.NativeStart.main(Native Method) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): Caused by: java.lang.ClassCastException: org.ksoap2.SoapFault 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at com.demo.view.Demo.getNewsDetails(Demo.java:141) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at com.demo.view.Demo.onCreate(Demo.java:36) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586) 04-20 18:32:24.245: ERROR/AndroidRuntime(940): ... 11 more </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload