zoukankan      html  css  js  c++  java
  • webservies

    NSString *soapStr = [NSString stringWithFormat:@"<?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:Header>

                             </soap:Header>

                             <soap:Body>

                             <downPdf xmlns="http://tempuri.org/">

                             <sid>?</sid>

                             <querytime>?</querytime>

                             <fileName>%@</fileName>

                             </downPdf>

                             </soap:Body>

                             </soap:Envelope>",pdfLind];

        

        

        

        //name="GetString"

        

        NSURL *url=[NSURL URLWithString:@" http://203.132.203.57:8066/Interface/AppService.asmx?WSDL"];

        

        NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];

        

        // 访问方式

        [request setHTTPMethod:@"POST"];

        

        // 设置请求头(请求头也可以不设置,前两个设不设置都一样,应该默认的,但是SOAPAction我怎么都设置不对,不设置也可以,干脆不设置了)

        [request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

        [request addValue:[NSString stringWithFormat:@"%zd", soapStr.length] forHTTPHeaderField:@"Content-Length"];

        // [request addValue:@"nameSpace/methodName" forHTTPHeaderField:@"SOAPAction"];

        

        // body内容

        [request setHTTPBody:[soapStr dataUsingEncoding:NSUTF8StringEncoding]];

        

        NSURLSession *session = [NSURLSession sharedSession];

        

        NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

            

            

                

                

            }

            

            

               }];

        

        [task resume];

        

        

    一天一章
  • 相关阅读:
    【一天一道兼容性】之——IE6下fixed失效
    【前端重构技能天赋】(三)——最终篇
    Putty中文乱码问题
    Cygwin Application initialization failed: no display name and no $DISPLAY environment
    c++中的string用法(二)
    在win7下面使用cygwin,并且安装使用git,以及git简明教程
    vi 一些命令(备忘,自己用的)
    对C++中string类型的总结
    ofstream和ifstream详细用法
    写第一个shell脚本,遇到的问题总结整理。
  • 原文地址:https://www.cnblogs.com/hangman/p/6867888.html
Copyright © 2011-2022 走看看