ParseException: Unparseable date With Ksoap Parsing - android

I am developing an app in which i nee dto parse "date" in KSOAP base webservices,i need to Pass Date at server with formate of "MM/dd/yyyy" so i have use SimepldateFormate and pass Date string to that date class but here something is wrong that getting me error like
Error:
08-13 14:45:20.031: ERROR/KsoapDemoActivity(562): Exception=>java.text.ParseException: Unparseable date: "08/01/2011"
i have also rend request with Date Class in KSoap like pi1.setType(Date.class); but not getting solve.I have also tried with make Class MarshalDate mdouble = new MarshalDate(); but not getting solution
can you please help me out this
Here is my code
private void InsertClientDetailForMobApp() {
// TODO Auto-generated method stub
try {
String NAMESPACE = "urn:MobileApplicationIntf-IMobileApplication";// "http://tempuri.org/";
String METHOD_NAME = "InsertClientDetailForMobApp";
String SOAP_ACTION = "urn:MobileApplicationIntf-IMobileApplication#InsertClientDetailForMobApp";
String URL = ("URL");//
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pi1 = new PropertyInfo();
pi1.setName("asfirstname");
pi1.setValue("Nikunj");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi2 = new PropertyInfo();
pi1.setName("asLastName");
pi1.setValue("patel");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi3 = new PropertyInfo();
pi1.setName("asNationalID");
pi1.setValue("25125514");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi4 = new PropertyInfo();
pi1.setName("asCountryissued");
pi1.setValue("asdasdasd");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi5 = new PropertyInfo();
pi1.setName("asLicenceNo");
pi1.setValue("asdasd");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi6 = new PropertyInfo();
pi1.setName("asPassportNo");
pi1.setValue("12512513221321");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi7 = new PropertyInfo();
pi1.setName("asGender");
pi1.setValue("M");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi8 = new PropertyInfo();
pi1.setName("asAddress1");
pi1.setValue("Indasdas asd as aia");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi9 = new PropertyInfo();
pi1.setName("asAddress2");
pi1.setValue("asdas asd asdasdas ");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi10 = new PropertyInfo();
pi1.setName("asCountry");
pi1.setValue("India");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi11 = new PropertyInfo();
pi1.setName("asCity");
pi1.setValue("Ahmedabad");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi12 = new PropertyInfo();
pi1.setName("asProvince");
pi1.setValue("Gujarat");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi13 = new PropertyInfo();
pi1.setName("asZip");
pi1.setValue("356256");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi14 = new PropertyInfo();
pi1.setName("asDayTelephone");
pi1.setValue("15165165565456");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi15 = new PropertyInfo();
pi1.setName("asEveTelephone");
pi1.setValue("5545654654");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi16 = new PropertyInfo();
pi1.setName("asFAX");
pi1.setValue("54145615");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi17 = new PropertyInfo();
pi1.setName("asEmail");
pi1.setValue("nkpatel#asd-infotech.com");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi18 = new PropertyInfo();
pi1.setName("asUserName");
pi1.setValue("Nik123");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi19 = new PropertyInfo();
pi1.setName("asPassword");
pi1.setValue("India");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi20 = new PropertyInfo();
pi1.setName("asLanguege");
pi1.setValue("English");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi21 = new PropertyInfo();
pi1.setName("asQuestion1");
pi1.setValue("Question1");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi22 = new PropertyInfo();
pi1.setName("asAnswer1");
pi1.setValue("Nothing1");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi23 = new PropertyInfo();
pi1.setName("asQuestion2");
pi1.setValue("what1");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi24 = new PropertyInfo();
pi1.setName("asSSN");
pi1.setValue("123456");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi25 = new PropertyInfo();
pi1.setName("asAnswer2");
pi1.setValue("Nothing2");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi26 = new PropertyInfo();
pi1.setName("asPrimaryCurrency");
pi1.setValue("INR");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi27 = new PropertyInfo();
pi1.setName("asSecondaryCurrency");
pi1.setValue("USD");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi28 = new PropertyInfo();
pi1.setName("asAgentID");
pi1.setValue("456");
pi1.setType(String.class);
Request.addProperty(pi1);
PropertyInfo pi29 = new PropertyInfo();
pi1.setName("asBranchCode");
pi1.setValue("Tcom India");
pi1.setType(String.class);
Request.addProperty(pi1);
String str_date = "08/01/2011";
// yyyy-MM-dd'T'HH:mm:ss
DateFormat formatter;
Date date;
//formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
formatter = new SimpleDateFormat("MM-dd-yyyy");
date = (Date) formatter.parse(str_date);
PropertyInfo pi30 = new PropertyInfo();
pi1.setName("dtDOB");
pi1.setValue(date);
pi1.setType(Date.class);
Request.addProperty(pi1);
/*
* Call the web service and retrieve result ... how luvly <3
*/
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(Request);
AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(
URL);
MarshalDate mdouble = new MarshalDate();
mdouble.register(envelope);
androidHttpTransport.call(SOAP_ACTION, envelope);
Log.i("TAG", "soapResponse=>" + envelope.getResponse());
} catch (Exception e) {
soapResponseObject = null;
Log.e(TAG, "niraliwebservice() Exception=>" + e);
}
}
MarshalDate
package com.KsoapDemo;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.kobjects.isodate.IsoDate;
import org.ksoap2.serialization.Marshal;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
public class MarshalDate implements Marshal
{
public Object readInstance(XmlPullParser parser, String namespace, String name,
PropertyInfo expected) throws IOException, XmlPullParserException {
return IsoDate.stringToDate(parser.nextText(), IsoDate.DATE_TIME);
}
public void register(SoapSerializationEnvelope cm) {
cm.addMapping(cm.xsd, "DateTime", Date.class, this);
}
public void writeInstance(XmlSerializer writer, Object obj) throws IOException {
writer.text(IsoDate.dateToString((Date) obj, IsoDate.DATE_TIME));
}
}
UPDATE:
I have Change "08-01-2012" to "08/01/2012"
but now it raise me error
SoapFault - faultcode: 'SOAP-ENV:Server' faultstring: 'Access violation at address 00405818 in module 'MobileApp.exe'. Read of address 69570A03' faultactor: '' detail: null

Use / instead of - in simpleDateFormat...
formatter = new SimpleDateFormat("MM/dd/yyyy");

you've used the wrong pattern in your SimpleDateFormat class
use:
formatter = new SimpleDateFormat("MM/dd/yyyy");
instead of:
formatter = new SimpleDateFormat("MM-dd-yyyy");

Register your MarshalDate to your SOAP Envelope:
MarshalDate _MarshalDate = new MarshalDate();
_MarshalDate.register(soapEnvelope);
Then continue with your properties until the date that you want to pass and do this:
PropertyInfo _PropertyInfo = new PropertyInfo();
_PropertyInfo.setName("yourParameterInYourMethodeInTheWebService");
_PropertyInfo.setType(Date.class);
_PropertyInfo.setValue(yourVariableOfTypeDate);
soapReq.addProperty(_PropertyInfo);

Related

get PDF file path from Android internal storage for soap request in android

I can successfully create a PDF using iText and I am able to store in internal storage with getting file path.
On button click I have to call a service by passing 12 parameters and one of them is a stored PDF file path from the internal storage of the phone.
PROBLEM File not found error comes in server log even when while debugging through breakpoints on arg0 parameter.
How do I get the PDF file path to read it as a parameter value?
class Generatepdf extends AsyncTask<Void, Void, String> {
#Override
protected void onPreExecute() {
showDialog(CONNECTING_PROGRESS_DIALOG);
}
#Override
protected String doInBackground(Void... params) {
String outRes;
File myInternalFile;
HttpTransportSE androidTransport = null;
try {
final String NAMESPACE = "http://ws.xxxx.xxx.com/";
final String METHOD_NAME = "getPDF";
final String SOAP_ACTION = "";
final String WSDL_URL = "http://localhost:8080/services/getpdf?wsdl";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo propOne = new PropertyInfo();
PropertyInfo propTwo = new PropertyInfo();
PropertyInfo propThree = new PropertyInfo();
PropertyInfo propFour = new PropertyInfo();
PropertyInfo propFive = new PropertyInfo();
PropertyInfo propSix = new PropertyInfo();
PropertyInfo propSeven = new PropertyInfo();
PropertyInfo propEight = new PropertyInfo();
PropertyInfo propNine = new PropertyInfo();
PropertyInfo propTen = new PropertyInfo();
PropertyInfo propEleven = new PropertyInfo();
PropertyInfo propTwelve = new PropertyInfo();
PropertyInfo propThirteen = new PropertyInfo();
//parameter one
File readpdfFile = new File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "/NewPDF_.pdf");
propOne.setName("arg0");
propOne.setValue(readpdfFile);
// propOne.setValue(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/NewPDF_");
// propOne.setValue(Environment.getExternalStorageDirectory().getPath() + "/PDF/NewPDF_.pdf");
request.addProperty(propOne);
//parameter two
propTwo.setName("arg1");
propTwo.setValue("xxxxxxxxxxxx (some 12 digit number)");
request.addProperty(propTwo);
//parameter three
propThree.setName("arg2");
propThree.setValue("ACuoAEB6ADmwAIAuADy4AIDCAEWkAIBwAFYwAIBbAFrAAIAqAF9UAIBnAGE8AEBZAGs8AEDmAGu4AIB3AG0wAIA2AHRQAEDFAHS0AIBEAIBMAIDjAIU0AEB6AIcwAIA4AIxYAICKAJCkAEBwAJ50AIBSAKhYAIBwAKoYAECBAKqMAICTAKykAICbALakAI");
request.addProperty(propThree);
//parameter four
propFour.setName("arg3");
propFour.setValue("name");
request.addProperty(propFour);
//parameter five
propFive.setName("arg4");
propFive.setValue("Test");
request.addProperty(propFive);
//parameter Six
propSix.setName("arg5");
propSix.setValue("cityname");
request.addProperty(propSix);
//parameter Seven
propSeven.setName("arg6");
propSeven.setValue("First");
request.addProperty(propSeven);
//parameter Eight
propEight.setName("arg7");
propEight.setValue("BottomRight");
request.addProperty(propEight);
//parameter Nine
propNine.setName("arg8");
propNine.setValue("null");
request.addProperty(propNine);
//parameter ten
propTen.setName("arg9");
propTen.setValue("Biometric");
request.addProperty(propTen);
//parameter Eleven
propEleven.setName("arg10");
propEleven.setValue("false");
request.addProperty(propEleven);
//parameter Twelve
propTwelve.setName("arg11");
propTwelve.setValue("device1341I089864");
request.addProperty(propTwelve);
//parameter Thirteen
propThirteen.setName("arg12");
propThirteen.setValue("true");
request.addProperty(propThirteen);
//soap method call
SoapSerializationEnvelope envelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope2.setOutputSoapObject(request);
envelope2.implicitTypes = false;
androidTransport = new HttpTransportSE(WSDL_URL);
androidTransport.debug = true;
androidTransport.call(SOAP_ACTION, envelope2);
SoapObject response2 = (SoapObject) envelope2.bodyIn;
String requestDump = androidTransport.requestDump;
String responseDump = androidTransport.responseDump;
Log.i("", "Request: " + requestDump);
Log.i("", "Response: " + responseDump);
outRes = response2.toString();
Result= outRes;
Log.d("Result", Result);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Result;
}
#Override
protected void onPostExecute(String response) {
removeDialog(CONNECTING_PROGRESS_DIALOG);
runOnUiThread(new Runnable() {
public void run() {
responseTxtView15.setText("RESPONSE " + Result);
}
});
}
}

Android-Magento- How to add product to cart using ksop2

I am building android application using soap api in magento which has ability to sell products on mobile.
I am using ksoap2 library file.
But problem is that i am not able to add product to cart using function shoppingCartProductAdd.
Its gives error Product’s data is not valid
So please help me if you have better methode to add a product to cart
Here is my code that add product to cart
SoapObject request;
Method_Name = "shoppingCartCreate";
SOAP_ACTION = "urn:Magento/shoppingCartCreate";
try {
SoapSerializationEnvelope env = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
env.dotNet = false;
env.xsd = SoapSerializationEnvelope.XSD;
env.enc = SoapSerializationEnvelope.ENC;
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
request = new SoapObject(NAMESPACE, Method_Name);
request.addProperty("sessionId", sessionId);
env.setOutputSoapObject(request);
androidHttpTransport.call("SOAP_ACTION", env);
cartId = env.getResponse().toString();
SoapObject loresponse = new SoapObject(NAMESPACE,
"shoppingCartProductEntity");
PropertyInfo pi = new PropertyInfo();
pi.setName("product_id");
pi.setValue(cartitem.getItemId());
pi.setType(String.class);
loresponse.addProperty(pi);
pi = new PropertyInfo();
pi.setName("sku");
pi.setValue(cartitem.getSku());
pi.setType(String.class);
loresponse.addProperty(pi);
pi = new PropertyInfo();
pi.setName("qty");
pi.setValue(cartitem.getQuantity());
pi.setType(Double.class);
loresponse.addProperty(pi);
request = new SoapObject(NAMESPACE, "shoppingCartProductAdd");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", cartId);
request.addProperty("productsData", loresponse);
env.setOutputSoapObject(request);
androidHttpTransport
.call("urn:Magento/shoppingCartProductAdd", env);
boolean result1po = (Boolean) env.getResponse();
}
catch (Exception ex) {
Log.e(TAG, "Error: " + ex.getMessage());
}
Use below code to Create ProductArray.I think "shoppingCartProductEntityArray" is missing
//Create Product Array
SoapObject item = new SoapObject(NAMESPACE, "shoppingCartProductEntity");
PropertyInfo pinfo = new PropertyInfo();
pinfo.setName("product_id");
pinfo.setValue("91");
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("sku");
pinfo.setValue("SFS-123");
pinfo.setType(String.class);
item.addProperty(pinfo);
pinfo = new PropertyInfo();
pinfo.setName("qty");
pinfo.setValue("2");
pinfo.setType(Double.class);
item.addProperty(pinfo);
SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray");
EntityArray.addProperty("products",item);
SoapObject request = new SoapObject(NAMESPACE, "shoppingCartProductAdd");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", 166);
request.addProperty("products",EntityArray);

Android KSOAP2 Error

I am using the jar(ksoap2-android-assembly-2.6.5-jar-with-dependencies) and have a web -
services.url = http://62.244.199.18:8888/ergo-ergoService-context-root/ergoSoapHttpPort?WSDL
and my code is below
private static final String METHOD_NAME = "checkloginnew";
private static final String SOAP_ACTION = "http://ergoconn/Ergo.wsdl/checkloginnew";
private static final String NAMESPACE = "http://ergoconn/Ergo.wsdl";
private static final String URL = "http://62.244.199.18:8888/ergo-ergoService-context-root/ergoSoapHttpPort?WSDL";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pi = new PropertyInfo();
pi.setName("pPid");
pi.setValue(1149688);
pi.setType(BigDecimal.class);
request.addProperty(pi);
PropertyInfo pi2 = new PropertyInfo();
pi2.setName("pPass");
pi2.setValue("074920");
pi2.setType(String.class);
request.addProperty(pi2);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
httpTransport.debug = true;
httpTransport.call(SOAP_ACTION, envelope);
SoapObject result=(SoapObject)envelope.getResponse();
But I get an error "Caught exception while handling request: unrecognized operation: {http://ergoconn/Ergo.wsdl}checkloginnew"
In my httpTransport.responseDump:
<faultcode>env:Client</faultcode><faultstring>Caught exception while handling request: unrecognized operation: {http://ergoconn/Ergo.wsdl}checkloginnew</faultstring></env:Fault>
Thanks very much

Issue with sending data to a webservice, with ksoap

Good evening,
I need your help.
Until now, using my webservice to withdraw data, there was no problem.
Even to receive the data, I have to send some. Example: Login.
However, now I want to send data to the webservice, and it will only return "true or false".
I know I have the necessary data, but does not do what is supposed to do.
That is, the method I am invoking, it needs to receive data, and with these data it does the update in the database.
I know which works manually, directly on webservice.
what might be wrong?
Below is the code:
After insert the data on the app on android, when i click on a button, do this:
The message on the end, is the way that i know that i send real data:
try
{
newpassword = newPass;
Abreviatura = (EditText)findViewById(R.id.txtAbreviatura);
newabreviatura = Abreviatura.getText().toString();
Nome = (EditText)findViewById(R.id.txtNome);
newnome = Nome.getText().toString();
User = (EditText)findViewById(R.id.txtUsername);
newusername = User.getText().toString();
rslt="START";
Caller c=new Caller(); c.newNome = newnome;
c.newUser = newusername; c.newPass = newpassword;
c.newAbrev = newabreviatura; c.oldusername = oldusername;
c.ad=ad;
c.join(); c.start();
while(rslt=="START") {
try {
Thread.sleep(10);
}catch(Exception ex) {
}
}
ad.setTitle("Alteração:");
ad.setMessage(BIQActivity.comando + ";" + newnome + ";" + newpassword + ";" + newabreviatura + ";" + newusername + ";" + oldusername);
ad.show();
}catch(Exception ex)
{
}
That function, uses this peace of code, to send data to the next code:
csup=new CallSoapUpdatePerfil();
String resp=csup.CallUpdatePerfil(newUser, newNome, newPass, newAbrev, ldusername);
Perfil.rslt = resp;
Finally, this is the code that send's the data to the webservice:
public class CallSoapUpdatePerfil {
public final String SOAP_ACTION = "http://tempuri.org/UpdatePerfil";
public final String OPERATION_NAME = "UpdatePerfil";
public final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
public final String SOAP_ADDRESS = "http://10.0.2.2:80/BIQAndroid/BIQAndroid.asmx";
public String CallUpdatePerfil(String User, String Pass, String Nome, String Abrev, String oldusername)
{
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
PropertyInfo pi=new PropertyInfo();
pi.setName("User");
pi.setValue(User);
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("Pass");
pi.setValue(Pass);
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("Abrev");
pi.setValue(Abrev);
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("Nome");
pi.setValue(Nome);
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("oldusername");
pi.setValue(oldusername);
pi.setType(String.class);
request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
Object response=null;
try
{
httpTransport.call(SOAP_ACTION, envelope);
response = envelope.getResponse();
}
catch (Exception exception)
{
response=exception.toString();
}
return response.toString();
}
}
If anyone can help... Regards.
I already find the error. The error is about the name of parameter of webservice. :s
Done.
Thanks anyway.

How can i call a web service without using KSOAP2 in Android?

I can call a webservice with KSOAP2 from android,now i want to know is it possible to call it without using KSOAP.If anyone knows the answer please help me.
If the webservice is available with a rest api I would use Restlet. I have some blog posts that show simple examples of using this library here.
public class SOAPActivity extends Activity {
private final String NAMESPACE = "http://www.webserviceX.NET/";
private final String URL = "http://www.webservicex.net/ConvertWeight.asmx";
private final String SOAP_ACTION = "http://www.webserviceX.NET/ConvertWeight";
private final String METHOD_NAME = "ConvertWeight";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject soapObject=new SoapObject(NAMESPACE, METHOD_NAME);
String weight = "700";
String fromUnit = "Kilograms";
String toUnit = "Grams";
PropertyInfo weightProp =new PropertyInfo();
weightProp.setName("Weight");
weightProp.setValue(weight);
weightProp.setType(double.class);
soapObject.addProperty(weightProp);
PropertyInfo fromProp =new PropertyInfo();
fromProp.setName("FromUnit");
fromProp.setValue(fromUnit);
fromProp.setType(String.class);
soapObject.addProperty(fromProp);
PropertyInfo toProp =new PropertyInfo();
toProp.setName("ToUnit");
toProp.setValue(toUnit);
toProp.setType(String.class);
soapObject.addProperty(toProp);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(soapObject);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
Log.i("myApp", response.toString());
TextView tv = new TextView(this);
tv.setText(weight+" "+fromUnit+" equal "+response.toString()+ " "+toUnit);
setContentView(tv);
} catch (Exception e) {
e.printStackTrace();
}
}
}
This is simple code for SOAP web service,

Categories

Resources