简体   繁体   English

WCF手动SOAP POST,通过HttpWebRequest和Usertoken在https上使用

[英]WCF Manual SOAP POST using HttpWebRequest over https with Usertoken

I'm writing a client that calls a number of WCF webservices (written externallyt to my company) that are very similar in structure. 我正在编写一个调用许多结构相似的WCF Web服务(在外部写给我的公司)的客户端。 The design I was hoping to use is to manually build the SOAP message from XML chunks that are stored in a database and then processed through a generic web service handler class. 我希望使用的设计是从存储在数据库中的XML块中手动构建SOAP消息,然后通过通用Web服务处理程序类进行处理。 I have access to the WSDL's for each webservice and example working XML. 我可以访问每个Web服务和工作XML示例的WSDL。 The design approach is such that we can easily add to the message dynamically, hence the reason for not using the auto generated proxy classes 这种设计方法使我们可以轻松地动态添加消息,因此不使用自动生成的代理类的原因

I am basically at the last part now with the entire SOAP message constructed but am getting a SOAP fault security error returned. 我现在基本上已经构建了整个SOAP消息的最后一部分,但是却收到了返回的SOAP错误安全性错误。 I have used fiddler to compare the message I'm sending with one that is sent using the normal (far simpler...) WCF generated proxy classes and can't see any difference apart from the id attribute of the Usertoken element in the SOAP header. 我已经用提琴手来比较我发送的消息和使用普通(更简单...)WCF生成的代理类发送的消息,除了SOAP中Usertoken元素的id属性外,看不到任何区别标头。

This is where my lack of experience in this area isn't helping. 这是我在该领域缺乏经验无法解决的地方。 I think this is because the id is generated automatically (presumably because we're using https). 我认为这是因为ID是自动生成的(大概是因为我们使用的是https)。

My question is how do I generate this programatically? 我的问题是如何以编程方式生成此代码? I have searched for hours online but the majority of solutions are either using the proxy classes or not over https. 我已经在网上搜索了几个小时,但大多数解决方案要么使用代理类,要么不使用https。 I have briefly looked at WCE but aware this is replaced by WCF now so don't want to waste time looking into this if it's not the solution. 我简要地看了一下WCE,但是知道现在WCF已经取代了它,所以如果不是解决方案,不要浪费时间研究它。

Any help with this would be greatly appreciated. 任何帮助,将不胜感激。 I can post some code examples when I'm back in work if it will help but the method I'm using is very straightforward and only using XElements and such like at the moment (as we're using linq to sql). 我可以在工作时发布一些代码示例,如果有帮助,但是我使用的方法非常简单,仅使用XElements之类的代码(例如,现在使用linq to sql)。

thanks, 谢谢,

Andy 安迪

Found the issue which was mixed up namespaces, so had the wrong end of the stick when I posted this question. 发现了混合了名称空间的问题,所以当我发布此问题时遇到了错误的结局。 All working nicely now. 现在一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM