Sabby
Sabby

Reputation: 2592

Web service in iphone

Hi everyone i am new to iphone development.I am working on an application which required to check and register the user name and password using soap web service.could anyone help me how to do that with that web service.i have two text fields for login.and button to check if the credentials are correct or not.

Upvotes: 2

Views: 191

Answers (1)

vikingosegundo
vikingosegundo

Reputation: 52237

Maybe this is helpful for you: http://devmylife.com/?p=111

The website disappeared, you can find it here: http://web.archive.org/web/20100704000223/http://devmylife.com/?p=111


ASIHTTP SOAP Request

First of all down http://www.soapui.org/ or any packet sniffing app. and try requesting your SOAP-service. When you get the SOAP-packet, you have to exactly generate the same packet using ASIHTTP. You have to add headers yourself.

Download latest version of ASIHTTP

NSString *urlString = URL_HOST;
NSString *soapMessage = [NSString stringWithFormat:@"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
                             "<SOAP-ENV:Body>"
                             "<m:getInboxPosts xmlns:m=\"urn:finditnearwsdl\">"
                             "<input xsi:type=\"tns:InboxPostsRequest\">"
                             "<session_id xsi:type=\"xsd:string\">%@</session_id>"
                             "<page_size xsi:type=\"xsd:int\"></page_size>"
                             "<offset xsi:type=\"xsd:int\"></offset>"
                             "</input>"
                             "</m:getInboxPosts>"
                             "</SOAP-ENV:Body>"
                             "</SOAP-ENV:Envelope>" ,adBo.sessionId];
NSLog(soapMessage);
 
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:urlString];
[request appendPostData:[soapMessage dataUsingEncoding:NSUTF8StringEncoding];
[request addRequestHeader:@"SOAPAction:" value:SOAP_ACTION];
[request startSynchronous];

Upvotes: 1

Related Questions