茫然不知如何创建SOAP< WSSE:安全>头 [英] Clueless about how to create SOAP <wsse:Security> header

查看:939
本文介绍了茫然不知如何创建SOAP< WSSE:安全>头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经接近无经验的SOAP协议。该服务,我需要连接到需要的头。我想这是有些标准的Java,但在C#中必须手动创建这个头。

I'm have near to none experience with SOAP protocol. The service I need to connect to required header. I think this is somewhat standard in Java but in C# one must create this header by hand.

没有人在这里已经能够连接到类似的服务:已创建的头或者甚至知道一些标准库,可以简化创建的头呢?你能分享一些code或引用?

Does anyone here been able to connect to similar service: have created the header or maybe even know about some standard library which would simplify creation of header? Can you share some code or references?

我还发现,也许头也会在使用WS2005产生的,因为WS3的插件为它的线索。任何人都可以发表意见吗?经过简单了解一下这个插件,我发现simmilar领域的Security头,但仍无法创建头。

I also found a clue that maybe header will be generated if using WS2005, because there is WS3 addin for it. Can anybody comment this? After quick look at this addin I found simmilar fields as in Security header, but still wasn't able to create the header.

推荐答案

滑稽您应该提及的是 - 我一直在做的完全的最近

Funny you should mention that - I've been doing exactly that recently.

我已经成功用做一个的SoapExtension ,它使用 ChainStream 保持原有流的副本,只是在 BeforeDeserialize 复制流,并在 AfterSerialize 添加标题。

I've managed to do it using a SoapExtension which uses ChainStream to keep a copy of the original stream, just copies the stream during BeforeDeserialize and adds the header during AfterSerialize.

添加标题是阅读的新流的内容的情况下(从 ChainStream 返回)为XML文档(的XDocument 在我的情况),加上头,然后将其写入>传入 ChainStream

Adding the header is a case of reading the contents of the "new" stream (returned from ChainStream) into an XML document (XDocument in my case), adding the header, and then writing it to the original stream passed into ChainStream.

不幸的是,这是pretty的脏,你不能(据我所知)使用带有适当的身份验证信息的新实例,当您需要。

Unfortunately this is pretty dirty, and you can't (as far as I'm aware) use a new instance with appropriate authentication information when you need to.

我已经得到的的使用 SOAPHEADER 相反,添加适当的属性添加到Web服务的每个方法,也是一种方式最的相应的字段/与所需的头的一个实例属性 - 但SOAP序列正在给我头痛指定正确的元素名称(使用命名空间)的条款。这件事情我已经打算邀请其他人时,我得到的时间。

I've got most of the way using a SoapHeader instead, adding an appropriate attribute to each method of the web service and also an appropriate field/property with an instance of the required header - but the SOAP serialization is currently giving me headaches in terms of specifying the right element names (with namespaces). It's something I've been planning to ask others about when I get the time.

抱歉没有能够给你一个完整的答案 - 也道歉缺乏code,它属于公司的,而不是我 - 。但希望它会至少给你一个起点

Sorry not to be able to give you a full answer - and also apologies for the lack of code, it belonging to the company rather than me - but hopefully it'll at least give you a starting point.

这篇关于茫然不知如何创建SOAP< WSSE:安全>头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆