当 WSDL 未定义它时如何传递 Soap 标头? [英] How To Pass Soap Header When WSDL Doesn't Define It?

查看:15
本文介绍了当 WSDL 未定义它时如何传递 Soap 标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我正在调用的 Web 服务,他们发布的 WSDL 实际上并没有定义大部分服务,其中 3/4 的服务必须在之后手动构建.

I have a web service that I am calling and their published WSDL doesn't actually define much of the service, 3/4 of it you have to manually build afterwards.

我遇到的问题是他们需要一个包含一些特定信息的 SoapHeader,但我没有任何方法可以做到.我拥有的唯一真实的服务是创建的代理方法 (MyMethod),我可以将消息传递给它.我怎样才能设置/发送一个肥皂头?

The problem I have is that they need a SoapHeader with some specific information in it, but I don't have any way of doing it. The only real things I have for the service is a proxy method that was created (MyMethod) that I can pass my message to. How can I set/send a soap header with it as well?

我拥有的所有服务,我都能够使用来自 Visual Studio 的自动绑定项目.

All of the services I've had, I have been able to use the automatically bound items from Visual Studio.

推荐答案

我能够通过手动修改自动生成的代理代码并简单地注入一个继承SoapHeader"的类并将属性添加到方法中来完成此操作!

I was able to get this done by modifying the auto-generated proxy code manually and simply injecting a class that inherited "SoapHeader" and added the attribute to the method!

我无法重新生成或重新刷新代理,但它完成了工作,并且只用了 15 分钟.

I cannot re-generate or re-fresh the proxy, but it got the job done, and only took 15 minutes.

这篇关于当 WSDL 未定义它时如何传递 Soap 标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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