Problem while calling the web services in android.

37 replies [Last post]
karthick
User offline. Last seen 2 years 26 weeks ago. Offline
Joined: 08/06/2009

To call web services in android I have done the following steps

1. Wrote the web service class in java and stored in apache axis. (in .jws format)

public class ADD2No
{
public int add(int a,int b)
{
return (a+b);
}

public int sub(int c,int d)
{
return (c-d);
}
}

2. Then is have tested the web service on web browser.

http://192.168.1.41:8081/axis/ADD2No.jws

I have got.

There is a Web Service here
Click to see the WSDL
in browser.
3. then I implement the service using core java and Ksoap2 library. Its working fine.

4. But I got error when I call the web service via android.

5. This is my code.

package com.example.SamWebService;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class WebServiceInAndroid extends Activity
{
/** Called when the activity is first created. */

/*
private static final String SOAP_ACTION = "HelloYou";
private static final String METHOD_NAME = "getHello";
private static final String NAMESPACE = "urn:HelloYou";
private static final String URL = "http://localhost/lab/service.php";
*/

private static final String SOAP_ACTION = "ADD2No";
private static final String METHOD_NAME = "add";
private static final String NAMESPACE = "urn:ADD2No";
private static final String URL = "http://elcserver:8081/axis/ADD2No.wsdl";

//private Object resultsRequestSOAP = null;

@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);

TextView tv = (TextView) findViewById(R.id.txt1);

setContentView(R.layout.main);

try
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("a", 3);
request.addProperty("b", 4);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//envelope.dotNet = true;
envelope.setOutputSoapObject(request);
AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);

try
{
androidHttpTransport.call(SOAP_ACTION, envelope);

//Parse Response

SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;

//String xy = resultsRequestSOAP.getProperty(0).toString();

tv.setText("Ganzes Rückagbeobjekt:\n"+resultsRequestSOAP.toString());

}

catch (Exception e)
{
e.printStackTrace();
}

}
catch(Exception e)
{
tv.setText("Error : " + e.getMessage());
}

}

}
6. I have tried lot of methods still I am getting the error.
“Your application has been stopped unexpectedly”

7. my application’s manifest file is

<?xml version="1.0" encoding="utf-8"?>

8. So give me solutions to overcome this problem and how to define the SOAP_NAME, METHOD_NAME, NAMESPACE and URL what they meant really.

9. Give me the step by step procedure to call apache axis web services from android.

1xuntong
User offline. Last seen 5 weeks 6 days ago. Offline
Joined: 12/25/2011
miu miu

comb the "two head" Bob, in order not to be poor, head wear on the left, the right wore , gold lotus leafprada purses outlet pin.

love-dress
User offline. Last seen 7 weeks 5 days ago. Offline
Joined: 12/15/2011
Wedding Dresses

Please feel free to post your programming questions or any discussion related to Android development.
www.mylove-dress.com

ROHITDON
User offline. Last seen 7 weeks 4 days ago. Offline
Joined: 04/04/2011
hello

I found your website perfect for my needs. It contains wonderful and helpful posts. I have read most of them and got a lot from them. To me, you are doing the great work.

bankruptcy attorney wow accounts for sale

kijijiie49
User offline. Last seen 14 weeks 1 day ago. Offline
Joined: 10/25/2011
Craigslist Toronto

i have no idea about it but i hope you find a perfect and easy solution of this problem.this post is also helpful for me to know about this problem.i like to read informative blogs and this blog is also so good and helpful.thanks for taking time to discus this topic..
Craigslist Toronto

sonu45
User offline. Last seen 14 weeks 3 days ago. Offline
Joined: 10/28/2011
I mean I do not think I've

I mean I do not think I've ever read anything as true in a long time. You've got a lot of great ideas, a lot of perspective. I think it definitely has something important to say and I'm going back to 110%, man. Good job keeping this issue alive and interesting. grad school personal statement

sharma
User offline. Last seen 16 weeks 5 hours ago. Offline
Joined: 07/24/2011
I have never heard such a

I have never heard such a beautiful way of talking about trees. Thanks for coming here Fernando. I feel very lucky to have met you - who now inhabit my memory tooCrescent Processing Company Complaints

ankurs127
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 01/04/2011
HELLO

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. alquiler de furgonetas en madrid            

sharma
User offline. Last seen 16 weeks 5 hours ago. Offline
Joined: 07/24/2011
I like reading articles and

I like reading articles and posts over the Internet, and I found your site and read your posts, I like here, so I bookmark your site, thank you for your posts. yamaha motorcycles

ankurs127
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 01/04/2011
HELLO

This is really useful and interesting information for me. It is easy to navigate, clean, uncluttered and the colors are very harmonious. If you want upright bagless vacuum cleaners no later visit franquicias rentables

tonnyvan21
User offline. Last seen 16 weeks 4 days ago. Offline
Joined: 10/13/2011
Many Thanks

Me too. I'm very interested of this information. I will call in androit. Because i want to make up my website. Please visit voyage vietnam pas cher

ankurs127
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 01/04/2011
HELLO

This video gives us a good guidance on how to make the agreeable PVC stand for our YAL Banner. Pretty good! Thanks for sharing

HerdonR
User offline. Last seen 17 weeks 2 days ago. Offline
Joined: 10/09/2011
Thanks for such a great and

Thanks for such a great and informative information and I really appreciate it.
economic calendar

HerdonR
User offline. Last seen 17 weeks 2 days ago. Offline
Joined: 10/09/2011
Thanks for the information

Thanks for the information regarding on Android application.
wsop

roxxky
User offline. Last seen 18 weeks 2 days ago. Offline
Joined: 12/04/2010
Right news

This is definitely a topic that's close to me so Im happy that you wrote about it. I'm also happy that you did the subject some justice. Not only do you know a great deal about it, you know how to present in a way that people will want to read more. Im so happy to know someone like you exists on the web. golf holidays in spain oferton de viajes
tva espagne
paginas de ventas

ankurs127
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 01/04/2011
health insurance quote

Good news.This is a great post. I like this topic.This site has lots of advantage. I found many interesting things from this site. It helps me many away.So i want some information for sharing this side with some of my friend. Thanks

health insurance quote

johnroman
User offline. Last seen 33 weeks 3 days ago. Offline
Joined: 10/26/2010
You must have done good

You must have done good research for the work, i appreciate your efforts. Looking for more updates from your side
jeux de mario
Juegos de Ben 10

HerdonR
User offline. Last seen 17 weeks 2 days ago. Offline
Joined: 10/09/2011
This was a great information

This was a great information and I am so greatful to visit this post.
Alpari

seetaiah nagaram
User offline. Last seen 34 weeks 2 days ago. Offline
Joined: 06/01/2011
nice discription

u take Userpermissions INTERNET in android manifestfile check it once

roxxky
User offline. Last seen 18 weeks 2 days ago. Offline
Joined: 12/04/2010
hiiiiiiiiiiiiiiiiiiiiiiii

The post is pretty interesting. I really never thought I could have a good read by this time until I found out this site. no deposit casino bonus

HarrisLangdon
User offline. Last seen 38 weeks 22 hours ago. Offline
Joined: 12/26/2010
Great explanation and it

Great explanation and it works well. I encountered the same problem when I tried to run an application to an easy saver rewards site. After I followed you advice step by step I managed to debug my application. Thanks!

xeeran
User offline. Last seen 25 weeks 2 days ago. Offline
Joined: 11/23/2010
nice one

Hi,The post is written in very a good manner and it entails many useful information for me.The code looks easy to implement. I appreciated what you have done here. I am always searching for informative information like this. Thanks for sharing with us
san diego printers

xeeran
User offline. Last seen 25 weeks 2 days ago. Offline
Joined: 11/23/2010
nice one

Thanks for the amazing article here. I was searching for something like that for quite a long time and at last I have found it here. Your blog is better than others because of useful and meaningful posts. Keep posting them in the future too, I will be waiting for that
custom signs
3d signs

sign company
vinyl letters

honeysara
User offline. Last seen 34 weeks 3 days ago. Offline
Joined: 09/29/2010
medicen

This technical implementations are great when you want to update your knowledge about the matter posted at the moment.
The OODA and things like that which is something quite complicated.
Area Rug

honeysara
User offline. Last seen 34 weeks 3 days ago. Offline
Joined: 09/29/2010
news

Wow i can say that this is another great article as expected of this blog.Bookmarked this site. pet memorial marker

honeysara
User offline. Last seen 34 weeks 3 days ago. Offline
Joined: 09/29/2010
news

I agree, those that are best prepared will be the ones that will reap the benefits Advertising Agency Jacksonville

honeysara
User offline. Last seen 34 weeks 3 days ago. Offline
Joined: 09/29/2010
news

This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article
SEO Orlando
Furniture Stores Pittsburgh

bimbim.in
User offline. Last seen 1 year 3 weeks ago. Offline
Joined: 01/13/2011
Calling dotnet web service method with complex type parameter

Calling web service on Android is possible with KSOAP2 (ksoap2-android-assembly-2.4-jar-with-dependencies.jar) or you can write you own soap message formatter and can make http call using android apache http classes.
In this post i am going to explain calling web service using ksoap lib for dotnet service. This web service is hosted at http://bimbim.in/Sample/TestService.asmx. You can use this for your reference because Android emulator is not connecting with local web development server which comes with Visual Studio ( i don’t know exact reason).

for more details please refer

jibkiller
User offline. Last seen 24 weeks 6 days ago. Offline
Joined: 12/08/2010
Best-of-Programm jedoch

Best-of-Programm jedoch probiert Josef Hader etwas, was viele Kollegen machen, er aber normalerweise nicht: Nummern spielen und dazwischen Lieder singen. payday loans

honeysara
User offline. Last seen 34 weeks 3 days ago. Offline
Joined: 09/29/2010
nice...

Its really great fun & Entertain education gifts for kids. Thanks for sharing
Attorneys Jacksonville

jaydeep.jadav
User offline. Last seen 1 year 9 weeks ago. Offline
Joined: 11/19/2010
I make the same what you

I make the same what you decribed here....and i use my pc's ip address in my webservice url but i am behing the proxy so what change i should do in code or settings?

Josefwhite
User offline. Last seen 1 year 38 weeks ago. Offline
Joined: 05/12/2010
Currently I am working for 4G

Currently I am working for 4G mobile solutions.I never or debug code for android.Mostly I worked for web static applications.I think solving dynamic web problems are quite tough.

JonahClint
User offline. Last seen 1 year 33 weeks ago. Offline
Joined: 05/20/2010
The new Andrioid upgrade

The new Andrioid upgrade manages calling the web services a lot better now. I had the same problem while working at a blair rewards site and the upgrade solved the problem for me.

neil
User offline. Last seen 16 weeks 2 days ago. Offline
Joined: 05/20/2009
try this

Try this link. maybe you can fix your code by this.





http://www.anddev.org/web_services_-_an_xml-rpc_client_for_android-t646.html

Cata
User offline. Last seen 47 weeks 5 days ago. Offline
Joined: 11/04/2010
Your link is down Neil. Is

Your link is down Neil. Is there a hosting problem right now ? I've ask you that just because the biggest problem seems to persist and I want a solve for this. Thank you guys ! rca ieftin

karen1leee
User offline. Last seen 20 weeks 6 days ago. Offline
Joined: 05/25/2011
Android Mobiles come from the

Android Mobiles come from the house of Google that adds up to the options that you have to choose from in the market.

best android apps

best iphone apps

ankurs127
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 01/04/2011
HELLO

If youre still on the fence: grab your favorite earphones, head down to a Best Buy and ask to plug them into a Zune then an iPod and see which one sounds better to you, and which interface makes you smile more. Then youll know which is right for you. seguro responsabilidad civil empresas

johnroman
User offline. Last seen 33 weeks 3 days ago. Offline
Joined: 10/26/2010
You must have done good

You must have done good research for the work, i appreciate your efforts. Looking for more updates from your side
jeux de mario
Juegos de Ben 10