How can I use ASIHTTPRequest to hit a .NET web service?

392 views
Skip to first unread message

jp chance

unread,
Oct 29, 2009, 11:23:16 AM10/29/09
to ASIHTTPRequest
I am creating a .NET web service. I want to be able to hit it using
ASIHTTPRequest from an iPhone. The interface to the web service is
called storeMetrics and takes four string parameters(call them a, b,
c, d). It does not return anything.

How would I go about calling the storeMetrics web service using
ASIHTTPRequest? I need to pass in a,b,c,d.

Thanks in advance.

enormego

unread,
Oct 29, 2009, 11:28:22 AM10/29/09
to ASIHTTPRequest
You can do it, but it's miserable to code around...just like .NET.

You'll need to set the raw postData to XML and interface with the
service that way.. If only there was a web service that let you simply
POST to it..

In conclusion, .NET sucks.

dotnetjunkie .

unread,
Oct 29, 2009, 11:52:10 AM10/29/09
to asihttp...@googlegroups.com
I have seen a code example for web services on the iPhone. It looked like I would have to construct my own soap packet. Sigh.... 


Is there anyway that ASIHTTPRequest could help? Or better suggestion? Example appreciated.


> Date: Thu, 29 Oct 2009 08:28:22 -0700
> Subject: Re: How can I use ASIHTTPRequest to hit a .NET web service?
> From: shnh...@gmail.com
> To: asihttp...@googlegroups.com

Ben Copsey

unread,
Oct 29, 2009, 11:55:32 AM10/29/09
to asihttp...@googlegroups.com
>> I am creating a .NET web service. I want to be able to hit it using
>> ASIHTTPRequest from an iPhone. The interface to the web service is
>> called storeMetrics and takes four string parameters(call them a, b,
>> c, d). It does not return anything.
>>
>> How would I go about calling the storeMetrics web service using
>> ASIHTTPRequest? I need to pass in a,b,c,d.

> You'll need to set the raw postData to XML and interface with the
> service that way.. If only there was a web service that let you simply
> POST to it..


If it's a SOAP service, you could take a look at:

http://code.google.com/p/wsdl2objc/

I haven't tried this myself, but it looks as though it will generate
code to perform the SOAP call for you from a WSDL url.

Alternatively, if the call is simple and this is a one off, you could
just build the XML manually as Shaun suggests.

If this is your own service, and it's only used for your iPhone app,
you will probably save yourself a lot of time if you simply accept the
parameters as part of a standard form post and use ASIFormDataRequest
instead. Any benefits you get from using SOAP will quickly evaporate,
as there is no native support for SOAP web services in the iPhone APIs.

Best,

Ben

dotnetjunkie .

unread,
Oct 29, 2009, 12:19:57 PM10/29/09
to asihttp...@googlegroups.com
Okay, looks like SOAP based services are going to be a pain. The problem is I don't know of another way to accomplish what I want. 

All I really want to do is to.

a.) Send data from my iPhone app to a server who will put that data in a database. This is a very easy web service to write in .NET but not easily connectable for iPhone. 

BTW, the server is GoDaddy so I also have a MySQL database. Does anyone know if you can hit it remotely using HTTP?

Or any other suggestions to gather data remotely?

Thanks in advance.


> Subject: Re: How can I use ASIHTTPRequest to hit a .NET web service?
> From: b...@allseeing-i.com
> Date: Thu, 29 Oct 2009 15:55:32 +0000
> To: asihttp...@googlegroups.com

opet

unread,
Oct 30, 2009, 10:23:53 AM10/30/09
to ASIHTTPRequest
I might not be as experienced, but to me it seems pretty easy to write
up a quick php app that writes to your MySQL database and accepts
POST...

Or?
> _________________________________________________________________
> Windows 7: Simplify your PC. Learn more.http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727...

aeberhar

unread,
Nov 2, 2009, 6:15:48 PM11/2/09
to ASIHTTPRequest
I am basically in the same position as you are (same background
with .net, same problem domain). As far as I can tell, the solution
most people are advocating is that I write REST services instead of
SOAP-based WebServices (fortunately, I've not yet written either) and
use ASIHTTPRequest to communicate between the server and the client.
My situation is somewhat more complicated because I need to support
online and offline states and will be using core data to achieve the
latter (I've not seen any examples of how to wireup core data to REST
services so I can simply call save on the object model context).
Definitely learning as I go. :-|
Reply all
Reply to author
Forward
0 new messages