String soapAction = "http://localhost/.../uploadposition";
String methodName = "uploadposition";
String endPoint = "http://localhost/.../s_position.php";
String result = null;
SoapObject object = null;
/ / Initialize soap request + add parameters
SoapObject request = new SoapObject (nameSpace, methodName);
request.addProperty ("long", lng);
request.addProperty ("lat", lat);
request.addProperty ("license", license);
request.addProperty ("sn", "");
request.addProperty ("stat", stat);
request.addProperty ("speed", (float) 0);
request.addProperty ("direction", "");
request.addProperty ("pin", "1111");
/ * Webservice input parameters
long: xsd: float
lat: xsd: float
license: xsd: string
sn: xsd: string
stat: xsd: int
speed: xsd: float
direction: xsd: string
pin: xsd: string
* /
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope (SoapEnvelope.VER11);
. (New MarshalBase64 ()) register (envelope);
envelope.setOutputSoapObject (request);
envelope.dotNet = true;
try {
HttpTransportSE androidHttpTransport = new HttpTransportSE (endPoint);
androidHttpTransport.call (soapAction, envelope);
object = (SoapObject) envelope.bodyIn;
result = object.getProperty ("return") toString ();.
if (envelope.getResponse ()! = null)
{
SoapPrimitive response = (SoapPrimitive) envelope.getResponse ();
result = response.toString ();
}
} Catch (Exception e) {
e.printStackTrace ();
}
The main function of this code is the current location information call weiservice upload user interface, but in the implementation of these two codes are always skip 41, 42, and thus can not get the return value, I do not know why. Before calling the server interface registered user information is no problem in the same way.
Which colleagues have encountered similar problems, hoping to kind! Thank
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->Reply:
androidHttpTransport.call (soapAction, envelope);? anomaly went gone exception handling section
Reply:
I use the same method to upload before registration information are not abnormal ah, the issue tangled for several days. This is the interface
http://61.180.240.111/taxi/s_position.php, Lin masonry you have the time to help me in the end to see what the problem is yet. Thank you very much
Reply:
androidHttpTransport.call (soapAction, envelope); instead androidHttpTransport.call (null, envelope); Try
Reply:
Feel your 41, 42 lines of code is redundant, you want to get response information directly
if (envelope.getResponse ()! = null)
{
/ / Response code to handle your
}
Reply:
41-48 return values that are two ways to take, I have these two methods were tried, but still can not. 3rd floor of methods tried, too.
Reply:
Performed when an exception is thrown: cannot serialize 126.8363,126.8363 is a float type. After uploading into the normal type String, the question now is how to upload a float value.
Reply:
http://stackoverflow.com / questions/6608701/android-how-to-pass-double-value-to-service-using-ksoap
After the reference to the site where the solution to the problem is resolved.
Reply:
transport.call (soapAction, envelope); thrown how to solve
No comments:
Post a Comment