• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error while connecting to webservices

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

following is my code for consuming webservices using SOAP.the webservice written in .net to insert a valueinto teh database.



getting this error in my phone
localhost/127.0.0.1:3601-connection refused


can anyone tell me what might be the problem???
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
these are the consts

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you running the application in the emulator?
In this case, localhost/127.0.0.1 points to the emulator itself.
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Localhost is device's own loopback interface, if you're trying to access your development machine use 10.0.2.2.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi...
thanks for the post
i have changed to


it says connection timed out now
i am running on my mobile
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suzzane,

In my post by device what I wanted to say is emulator, not a real device. If you wish to connect it from real device, you need to use the actual ip address or dns name of the server.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks swastik,

i have made the changes n now trying with the emulator first runnig on local host.
coded as follwos


now my logcat says:


can you plesae tell me why such error



 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

attr value delimiter missing! (position:START_TAG <html dir='null'>



So what looks is the xml being returned from the web service is not valid.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if this causing you a problem but your SOAP_ACTION stills point to localhost while you specify in the NAMESPACE points to 10.0.2.2
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use Wireshark to intercept traffic and see what is really going on.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i get same error when do this:

in my code i have given a toast after soap action which is not getting executed...somewhere i think it is unable to do SOAP_ACTION
anysuggestions
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyhelp??
m looking for suggestions
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone please tell me why dis error comes??

03-28 10:53:41.333: E/Error 879): Error on soapPrimitiveData() attr value delimiter missing! (position:START_TAG <html dir='null'>@2:11 in java.io.InputStreamReader@44c2d190)
followed my xmlpullparserexception.

i am strugling since 3 days....please help


thanks
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like the XML is not well-formed. Without seeing the complete XML there's not much we can suggest.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hanks,
but how can i look at the xml???
is there something to be done in the code while passing parameter

thanks
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my android code is:




the .net webservice code:



<%@ WebService Language="C#" Class="WebServiceDemo" %>

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;


[WebService(Namespace = "http://tempuri.org/", Description = "Webservice dimostrativo per JavaScript SOAP Client")]
public class WebServiceDemo : WebService
{

[WebMethod(Description = "Hello World!")]
public string HelloWorld()
{
return "Hello World!";
}

[WebMethod(Description = "Hello [YOUR NAME HERE]")]
public string HelloTo(string name)
{
//return "Hello " + name + "!";
int count = 1;
int rows;
//string shital = "www.ixifoto.com";
//SqlConnection myConnection = new SqlConnection(@"Data Source=208.91.198.196.76;Initial Catalog=webdata;User Id=ixi;Password=web1234;");
SqlConnection myConnection = new SqlConnection(@"Data Source=209.62.85.76;Initial Catalog=Ils;User Id=ibase;Password=123456;");

try
{
myConnection.Open();
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
// myCommand.CommandText = "insert into test123 (rec_name,city)values('" + shital + "','" + name + "')";
myCommand.CommandText = "insert into test123 (city)values('" + name + "')";
myCommand.Parameters.Add("@value", SqlDbType.VarChar).Value = name;
//rows = myCommand.ExecuteNonQuery();
myCommand.ExecuteNonQuery();

//SqlDataReader myReader = myCommand.ExecuteReader();

}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
myConnection.Close();
}

return "Done!!!";




}

should i post the xml soap which comes under the webservices when executed?
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use tools like tcpmon or Eclipse TCP/IP Monitor to view what is being sent and received.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the xml for request response as follows:
POST /test11/demos/dotnet/webservicedemo.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/HelloTo"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<HelloTo xmlns="http://tempuri.org/">
<name>string</name>
</HelloTo>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<HelloToResponse xmlns="http://tempuri.org/">
<HelloToResult>string</HelloToResult>
</HelloToResponse>
</soap:Body>
</soap:Envelope>
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please someone tell me....where lies the solution for this...searching long in google....couldnt find the solution


same error
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure that's what the code is throwing the exception for? It does not contain what the exception says:<html dir='null'> ...
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)when run on emulator with constants






logcat says:







 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i found that the exception posted above comes when i run on emulator.whereas when i run from the real device with functions changed


then the logcat says:





can you please tell me why this exception on phone..
i got the wifi connection also

 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i found that the exception posted above comes when i run on emulator.whereas when i run from the real device with functions changed


then the logcat says:





can you please tell me why this exception on phone..
i got the wifi connection also

 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The device doesn't seem to be on the local network.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and how do i check that....i have given the ip as well....
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the device on your local WLAN? Then it should work. If you're using the connectivity of your phone provider then you can't connect to a local address like 192.168.0.43
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now i am trying with the emulator




now the logcat says something like this:

please help

 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to get it done using emulator first on localhost.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,


i have removed my exception now giving proper namespace and url




my output at logcat says:





but my value is not getting inserted into the database inspite of getting the response correct


please suggest...im just a step away i think
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am facing problem in passing parameter to the webservice....

i have used simple request.addProperty("name","value");

any suggestions to solve this???
would be grtfull
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have solved my problem now in emulator,
any idea how to run on actual device???
please help
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything should be same, except the ip address. You need the actual ip address or the dns name of the server.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
iam running app on local server..giving my machine ip in the phone is not solving it......
any help??
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi..
please help with this...
iam trying to send a binary string to the server but getting exception as


server is receiving null

my converting to string as


the soap code is

please help me.....as i am stuck here since long...i would be greatfull if someone really provides an idea

thankyou
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not knowing what the app is sending, nor what the server is expecting, makes it just about impossible to advise.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my andriod app is sending image as base64string.....server is recieving and inserting into sql server database.....the exception is strange and cant get solution anywhere...before i have successfully inserted string into databse via webservice...cant get this....

plsss help

thanks
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's an image, then I wouldn't use SOAP, I'd just use HTTP.

There isn't nearly enough information for us to help with debugging. Talk with the author of the WS and get him to help you. He should be in a position to provide you with an example of what SOAP the WS expects. Then you need to ensure that that is what you are sending.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i send it using http??without server side script.. my webservice is written in .net.
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've no idea about .Net, sorry. For sending, you'd use the HttpClient library (which is part of Android). The extensive documentation and example code on its web site will tell you all you need to know about it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic