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

推荐订阅源

C
Cisco Blogs
Schneier on Security
Schneier on Security
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
Security Latest
Security Latest
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
Scott Helme
Scott Helme
Webroot Blog
Webroot Blog
Project Zero
Project Zero
Google Online Security Blog
Google Online Security Blog
The Last Watchdog
The Last Watchdog
Spread Privacy
Spread Privacy
Hacker News: Ask HN
Hacker News: Ask HN
PCI Perspectives
PCI Perspectives
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
W
WeLiveSecurity
Attack and Defense Labs
Attack and Defense Labs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News | PayPal Newsroom
Help Net Security
Help Net Security
The Hacker News
The Hacker News
H
Heimdal Security Blog
O
OpenAI News
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
Simon Willison's Weblog
Simon Willison's Weblog
G
GRAHAM CLULEY
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 叶小钗
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
I
Intezer
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Security Affairs
P
Proofpoint News Feed
S
Secure Thoughts
腾讯CDC
Google DeepMind News
Google DeepMind News
量子位
罗磊的独立博客

博客园 - dataxiu.com

[原创.数据可视化系列之十三]idw反距离权重插值算法的javascript代码实现 [原创.数据可视化系列之十二]使用 nodejs通过async await建立同步数据抓取 [原创.数据可视化系列之八]使用等d3进行灰度图转伪彩色 [原创.数据可视化系列之七]阿里竞赛作品技术展示 [原创.数据可视化系列之六]使用openlyaers进行公网地图剪切 [原创.数据可视化系列之五]韩国"萨德"系统防御图 [原创.数据可视化系列之四]跨平台,多格式的等值线和等值面的生成 [原创.数据可视化系列之三]使用Ol3加载大量点数据 [原创.数据可视化系列之二]使用cesium三维地图展示美国全球军事基地分布 [原创.数据可视化系列之一]使用openlayers 3 显示聚合数据 管理类软件的界面模板。 使用SilverLight开发ARPG游戏(一) 买联想学生机器的遭遇:问联想1(连载) 联想09年春节学生机开卖了。 谈UrlRewriter在XP和2003上IIS设置的差异 使用SilverLight构建插件式应用程序(九) —聊天插件客户端的实现 使用SilverLight构建插件式应用程序(八) —聊天插件Duplex WCF的实现 使用SilverLight构建插件式应用程序(七) 使用SilverLight构建插件式应用程序(六)
.NET 访问JAVA的WebService使用SOAP头
dataxiu.com · 2008-10-26 · via 博客园 - dataxiu.com

进来做的项目需要和JAVA的WebServices进行交互,其中访问WS的时候需要传入SOAP头进行验证。其中关键就是SOAP头内容。由于JAVA的WS在.NET下生成的代理是没有SOAP头的内容,所以需要手工修改代理类,达到可以传输SOAP头的目的。

1:修改代理类,建立SOAP头的对象:

 /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3053")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]  
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
    public partial class MySoapHeader : System.Web.Services.Protocols.SoapHeader
    {
        private string tokenValue;
        private System.Xml.XmlAttribute[] anyAttrField;
        /// <remarks/>
        //[XmlIgnoreAttribute]
        //[XmlAttribute("")]
        [XmlTextAttribute()]
        public string TokenValue
        {
            get
            {
                return this.tokenValue;
            }
            set
            {
                this.tokenValue = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlAnyAttributeAttribute()]
        public System.Xml.XmlAttribute[] AnyAttr
        {
            get
            {
                return this.anyAttrField;
            }
            set
            {
                this.anyAttrField = value;
            }
        }

    }

2:修改代理类,添加一个SOAP对象:

     private mySoapHeader soapHeaderValue;

    public MySoapHeader SoapHeaderValue
        {
            get
            {
                return this.soapHeaderValue;
            }
            set
            {
                this.soapHeaderValue = value;
            }

        }

 3:在需要SOAP上方法上添加如下的代码:

        [System.Web.Services.Protocols.SoapHeaderAttribute("SoapHeaderValue")]

   public bool verifyWebserviceTest()
        {
            object[] results = this.Invoke("verifyWebserviceTest", new object[0]);
            return ((bool)(results[0]));
        }

调用的时候使用如下代码:

  ArcWS.ManDispCmdSessionBeanService ws = new ARSSMonSite.ArcWS.ManDispCmdSessionBeanService();
            ArcWS.loginToken soapHeader = new ARSSMonSite.ArcWS.loginToken();
            soapHeader.TokenValue = "arsssongguixiang#19990101010101";
            ws.SoapHeaderValue = soapHeader;

            ws.verifyWebserviceTest();

这样,就可以正确的向JAVS的WS传送SOAP头的信息。