Reputation: 9317
I am developing an application in which i have to call a web service, i know the way to call the service through KSOAP2. Unfortunately I am provided with a WSDL file so i used the Sun Wireless Toolkit Stub Generator to generate the code. But the code contains the following packages which are not supported by Android.
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;
I do not know how to generate the code from the given WSDL for Android, if any body knows the solution please help me out.
Upvotes: 3
Views: 2904
Reputation: 31
I go through a lot of solution solution in WSDL 2 android. google don't matter about SOAP service and provide anything for it. wsdl2java won't work in most of case, some library cannot be use by android SDK. I suggest you to use http://easywsdl.com.
you'll see you can edit your own package name, class prefix and many other parameters depends on your need. If you have complex data and your are familiar to use Gson (https://code.google.com/p/google-gson/) to send parameter between your activities don't check "Use JodaDate" that is a great library for using date, but Gson doesn't support it (yet).
If you have few services that don't work (yes that can happen, depend of your WSDL configuration file), report it to contact and they will make the possible to fix your issue like they did for me.
The generator is fast. you will receive all your generated code and the .jar that you'll have to import into your project.
Upvotes: 2
Reputation: 2332
for example this one http://www.w3.org/2001/04/wsws-proceedings/uche/wsdl.html
namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd is the url GetEndorsingBoarder is a function
I think :)
this is a sample code ive used in my project
String SOAP_ACTION = "";
String METHOD_NAME = "theMethodName";
String NAMESPACE = "you can find the name space in the wsdl dile";
String URL="http://theServer/theService";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
Loger.logUrl(URL);
request.addProperty("argumentname",s );
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive p = (SoapPrimitive) envelope.getResponse();
return p.toString()
http://zvon.org/xxl/WSDL1.1/Output/index.html
Upvotes: 0