代码之家  ›  专栏  ›  技术社区  ›  Sabby

iphone中的Web服务

  •  2
  • Sabby  · 技术社区  · 15 年前

    1 回复  |  直到 15 年前
        1
  •  1
  •   vikingosegundo    14 年前

    也许这对你有帮助: http://devmylife.com/?p=111

    网站消失了,你可以在这里找到它: http://web.archive.org/web/20100704000223/http://devmylife.com/?p=111


    ASIHTTP SOAP请求

    首先是下降 http://www.soapui.org/ 或任何包嗅探应用程序。并尝试请求您的SOAP服务。当您得到SOAP包时,必须使用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];