惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - stonespawn

Vue 组件库2 Vue 的组件库 算法小题目 VS2019 自动代码补全功能 GIT 删除操作 vue-router 注意事项 Vue中axios访问 后端跨域问题 Vue2.0 搭配 axios Vue 脚手架搭建 grunt使用入门 Git相关操作及记录 关于JS 树形结构 导出EXCEL【Web方式HTML通过拼接html中table】 链接点击跳动问题 WatiN——Web自动化测试(三)【弹出窗口处理】 WatiN——Web自动化测试(二) WatiN——Web自动化测试(一) 网页调用服务程序 - stonespawn - 博客园 小问题 小技巧 :创建虚拟目录并将IIS里面.net配置版本设为2.0 - stonespawn
Ajax在调用含有SoapHeader的webservice方法
stonespawn · 2014-01-16 · via 博客园 - stonespawn
·         [WebService(Namespace = "http://tempuri.org/")]
·             [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
·             public class WebService4JQuery : System.Web.Services.WebService
·             {
·                 
·                 public TestHeader THeader;
·          
·                 [WebMethod]
·                 [SoapHeader("THeader")]
·                 public string TestSoapHeader()
·                 {
·          
·                     return "THeader Value: " + THeader.HeaderData;
·                 }
·             }
·          
·             public class TestHeader : SoapHeader
·             {
·                 public string HeaderData { get; set; }
·             }


#JQuery code in the webform page

<script type="text/javascript">
 
        function CallWebMethodWithHeader() {
 
            var soapXML = 
            "<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>" +
                "<TestHeader xmlns='http://tempuri.org/'>" +
                    "<HeaderData>111111111111</HeaderData>" +
                "</TestHeader>" +
            "</soap:Header>" +
            "<soap:Body>" +
                "<TestSoapHeader xmlns='http://tempuri.org/' />" +
            "</soap:Body>" +
            "</soap:Envelope>";
        
            $.ajax({
                url: "WebService4JQuery.asmx?op=TestSoapHeader",
                type: "POST",
                dataType: "xml",
                contentType:"text/xml; charset=utf-8",
                data: soapXML,
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('SOAPAction', 'http://tempuri.org/TestSoapHeader');
 
                },
 
                success: function (data) {
                    alert("webmethod call success");
                },
                error: function (err) {
                    alert("webmethod call failed");
                }
 
            });
 
        }
    </script>