0

I am developing an android application that uses web services and called APIs to send request and get the responses.

My application was working fine before but now when I am starting my applicaiton and try to Log in (First page of application) this shows the following warning and exceptions

My App code lines are :

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("requestXml", envelope1);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        Object response = null;
        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
            response = envelope.getResponse();
            authenticationLoginResponse = response.toString();
        } catch (Exception e) {
            e.printStackTrace();
        }

I am getting warning at following line:

androidHttpTransport.call(SOAP_ACTION, envelope);

Complete Warning log is:

05-28 17:09:06.819: W/System.err(1771): java.net.UnknownHostException: capsconnect.phasestreamtest.com
05-28 17:09:06.822: W/System.err(1771):     at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
05-28 17:09:06.832: W/System.err(1771):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
05-28 17:09:06.832: W/System.err(1771):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
05-28 17:09:06.832: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:69)
05-28 17:09:06.832: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
05-28 17:09:06.832: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
05-28 17:09:06.842: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
05-28 17:09:06.842: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
05-28 17:09:06.853: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
05-28 17:09:06.853: W/System.err(1771):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)
05-28 17:09:06.853: W/System.err(1771):     at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76)
05-28 17:09:06.853: W/System.err(1771):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:152)
05-28 17:09:06.853: W/System.err(1771):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
05-28 17:09:06.853: W/System.err(1771):     at commerce.app.lib.login.LoginScreen.performBackgroundProcess(LoginScreen.java:273)
05-28 17:09:06.862: W/System.err(1771):     at commerce.app.lib.login.LoginScreen.access$2(LoginScreen.java:233)
05-28 17:09:06.862: W/System.err(1771):     at commerce.app.lib.login.LoginScreen$1$1.run(LoginScreen.java:219)
05-28 17:09:06.862: W/System.err(1771): java.lang.NullPointerException
05-28 17:09:06.862: W/System.err(1771):     at java.io.StringReader.<init>(StringReader.java:46)
05-28 17:09:06.872: W/System.err(1771):     at commerce.app.lib.login.LoginScreen.performBackgroundProcess(LoginScreen.java:285)
05-28 17:09:06.872: W/System.err(1771):     at commerce.app.lib.login.LoginScreen.access$2(LoginScreen.java:233)
05-28 17:09:06.872: W/System.err(1771):     at commerce.app.lib.login.LoginScreen$1$1.run(LoginScreen.java:219)

Can any body suggest why this error is coming now while this project was running well few days ago?

Praveenkumar
  • 24,084
  • 23
  • 95
  • 173
Manoj Agarwal
  • 703
  • 3
  • 17
  • 39
  • Are you working with emulator ? If then uninstall the app and restart your emulator.. – hacker May 28 '12 at 07:27
  • @SpK Yes I have given permission – Manoj Agarwal May 28 '12 at 11:42
  • @bugfinder: Yes I am using emulator. But this app was running yesterday but not today. Why? – Manoj Agarwal May 28 '12 at 11:43
  • @SpK I am able to access the URL and web service directly. This application running well on iPhone using same URL and credentials and also running on emulator last week – Manoj Agarwal May 28 '12 at 11:52
  • Do you check this in your Android mobile? – Praveenkumar May 28 '12 at 11:55
  • @SpK: Yes. I checked on Mobile. It is working fine. Then can you tell me what is the issue that's why it is not running on emulator. My PC is on LAN. I think some network setting has disturbed. What setting should be checked? Can you guide me? Thanks :) – Manoj Agarwal May 29 '12 at 05:39
  • Can you please try [this](http://stackoverflow.com/a/2702663/940096) once. Because, sometimes emulator may lost its internet connections. – Praveenkumar May 29 '12 at 05:54

4 Answers4

2

the UnknownHostException is thrown to indicate that the IP address of a host could not be determined. So check for connection issue or if you can reach the server.

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
1

It really looks the reason your program crashes is not in "UnknownHostException" but rather in the way you calling Log.e() method. Double click one of the red lines:

AndroidRuntime(11689): at android.util.Log.e(Log.java:230) 05-16 01:32:56.280:

AndroidRuntime(11689): at commerce.app.lib.login.LoginScreen$1$1.run

and see if your IDE (Eclipse?) will take you to the lines in your code. Those are the ones that cause problems. Otherwise just check all your output.

Alehar
  • 639
  • 5
  • 16
0

check these:

Maybe your webservice address is changed in your code or webservice host is down now or you have set any proxy on your device.

Bob
  • 22,810
  • 38
  • 143
  • 225
0

you must be hard coding server IP. If you are using a LAN connection to test through a router, please check server IP again and change it in you application. When connected through router IP changes regularly. This can be one cause for unKnownHostException

drulabs
  • 3,071
  • 28
  • 35