简体   繁体   English

iPhone中的Web服务

[英]Web service in iphone

大家好,我是iphone开发的新手。我正在开发一个需要使用soap网络服务检查和注册用户名和密码的应用程序。有人可以帮助我如何使用该网络服务吗?我有两个文本字段登录和按钮以检查凭据是否正确。

Maybe this is helpful for you: http://devmylife.com/?p=111 也许这对您有帮助: http : //devmylife.com/?p=111

The website disappeared, you can find it here: http://web.archive.org/web/20100704000223/http://devmylife.com/?p=111 该网站消失了,您可以在这里找到它: http : //web.archive.org/web/20100704000223/http : //devmylife.com/?p=111


ASIHTTP SOAP Request ASIHTTP SOAP请求

First of all down http://www.soapui.org/ or any packet sniffing app. 首先关闭http://www.soapui.org/或任何数据包嗅探应用程序。 and try requesting your SOAP-service. 并尝试请求您的SOAP服务。 When you get the SOAP-packet, you have to exactly generate the same packet using ASIHTTP. 获取SOAP数据包时,必须使用ASIHTTP完全生成相同的数据包。 You have to add headers yourself. 您必须自己添加标题。

Download latest version of ASIHTTP 下载最新版本的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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM