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];

    

    

 

转载于:https://www.cnblogs.com/hangman/p/6867888.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值