Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid -How to pass double value to service using ksoap
    primarykey
    data
    text
    <p>In My application i want to pass the <code>double value</code> to the <code>web service</code> using <code>ksoap</code> but i am getting the <code>NPE</code>. In the code "exit_distance" is double value. can any body find the error in that and send the sample example</p> <p><strong>code here</strong></p> <pre><code>//valus required for test RB_Constant.RB_Webservice_URL = ? RB_Constant.RB_Webservice_Namespace = ? public String getExitsRestaurants() throws SoapFault { String data = ""; String serviceUrl = RB_Constant.RB_Webservice_URL; String serviceNamespace = RB_Constant.RB_Webservice_Namespace; String soapAction = "http://www.roadbrake.com/GetExitDetailsExtn"; String type_of_soap = "GetExitDetailsExtn"; try { SoapObject Request = new SoapObject(serviceNamespace, type_of_soap); PropertyInfo HighwayIdObj = new PropertyInfo (); HighwayIdObj.name = "HighwayId"; HighwayIdObj.type = PropertyInfo.INTEGER_CLASS; Request.addProperty("ExitNo", 7); Request.addProperty(HighwayIdObj, highwayid); Request.addProperty("HighwayName", 95); Request.addProperty("exit_distance", 1.2); System.out.println("Request Value-&gt;"+Request.toString()); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; MarshalDouble md = new MarshalDouble(); md.register(envelope); envelope.setOutputSoapObject(Request); try { HttpTransportSE androidHttpTransport = new HttpTransportSE(serviceUrl); androidHttpTransport.call(soapAction, envelope); } catch(Exception e) { System.out.println("Webservice calling error -&gt;"+e.toString()); } SoapPrimitive response = (SoapPrimitive)envelope.getResponse(); data = response.toString(); System.out.println("web service response-&gt;"+response.toString()); } catch(Exception e) { System.out.println("Soap Method Error -&gt;"+e.toString()); } return data; } public class MarshalDouble implements Marshal { @Override public Object readInstance(XmlPullParser parser, String namespace, String name, PropertyInfo expected) throws IOException, XmlPullParserException { return Double.parseDouble(parser.nextText()); } public void register(SoapSerializationEnvelope cm) { cm.addMapping(cm.xsd, exit_distance, Double.class, this); } @Override public void writeInstance(XmlSerializer writer, Object obj) throws IOException { writer.text(obj.toString()); } } </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.
 

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