I missed out to mention that I am using my system IP address in place
of localhost in Android application. So IP will not be any issue.
Please find the code snippet I am using for ksoap2.
private static final String SOAP_ACTION =
"getAndUpdateSurveyDetails";
private static final String METHOD_NAME =
"getAndUpdateSurveyDetails";
private static final String NAMESPACE =
"urn:android.webservices.src.com";
private static final String URL = "http://192.168.1.454:8080/axis/
services/SurveyDetails";
private SoapObject resultRequestSOAP = null;
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject inAddIntegers = new SoapObject(NAMESPACE,
"InAddIntegers");
inAddIntegers.addProperty("sName", "DEATH PENALTY");
inAddIntegers.addProperty("a", 20);
inAddIntegers.addProperty("b", 0);
request.addProperty("InAddIntegers", inAddIntegers);
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
AndroidHttpTransport androidHttpTransport = new
AndroidHttpTransport(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = envelope.getResponse();
Log.i(" Result is ","***"+ result.toString());
}
catch (Exception aE)
{
aE.printStackTrace ();;
}
On Jul 4, 8:47 pm, Prem <[EMAIL PROTECTED]> wrote:
> Hi All,
> I want to implement Web services in Android application. There is lots
> of post I found in this group regrading this but unfortunately none of
> is working in my case. Below are the mine requirements.
> 1. I had developed a service layer which will bring data from Mysql.
> 2. Service layer is deployed under Apache axis in tomcat server.
> 3. I already tested my web service application from simple Axis client
> application. Please find the working client code below:
> try {
>
> String endpointURL = "http://localhost:8080/axis/services/
> SurveyDetails";
> String name = "EDUCATION";
> long a = 100;
> long b =0;
> Service service = new Service();
> Call call = (Call) service.createCall();
>
> call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
> call.setOperationName( new
> QName("urn:android.webservices.src.com",
> "getAndUpdateSurveyDetails") );
> call.addParameter( "arg1", XMLType.XSD_STRING,
> ParameterMode.IN);
> call.addParameter( "arg2", XMLType.XSD_LONG, ParameterMode.IN);
> call.addParameter( "arg3", XMLType.XSD_LONG, ParameterMode.IN);
> //call.addParameter( "arg2", XMLType.XSD_INT,
> ParameterMode.IN);
>
> call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );
>
> String ret = (String) call.invoke( new Object[] {name,a,b} );
>
> System.out.println("@@@@"+ret );
> } catch (Exception e) {
> System.err.println(e.toString());
> }
>
> Now I want to convert this client on Android application. I tried with
> ksoap2,Xmlrpc as mention in previous posts but not able to get the
> solution.
> I have seen lots of people having the same issue.Some people might
> have overcome this issue. Please help me to overcome from this issue.
> I am really struggling with this issue.
> Please provide me code snippet to resolve this issue.
>
> Thanks in advance.
> Prem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---