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

        

        

    一天一章
  • 相关阅读:
    【javascript基础】JS计算字符串所占字节数
    mysql设置有外键的主键自增及其他
    spring AOP简单实现代码存放
    Dockerfile指令及docker的常用命令
    ubuntu 16.04 jenkins pipline的实现 最终docker启动服务
    ubuntu16.04 docker安装
    ubuntu16.04 nginx安装
    ubuntu14.04 spring cloud config server + gradle搭建
    ubuntu14.04 python2.7安装MySQLdb
    flask初次搭建rest服务笔记
  • 原文地址:https://www.cnblogs.com/hangman/p/6867888.html
Copyright © 2011-2022 走看看