我们分别获得了一组ASMX服务消费。我们在这些服务如何实现没有发言权。我们已经产生了一些代理与Wsdl.exe用的工具,但由于某些原因不明给我,这些生成的代理没有任何手段,包括自定义SOAP头。
We were given a set of ASMX services to consume. We have no say in how these services are implemented. We have generated a number of proxies with wsdl.exe tool but for some reason unknown to me, these generated proxies don't have any means for including custom SOAP headers.
基本上,我需要一种方法来定义标题数据添加到不同的服务电话。
Basically, I need a way to add custom header data to various service calls.
我知道存在的SoapExtension类的但不幸的是我们不能使用,由于所谓的性能问题。
I am aware of existence of SoapExtension class but unfortunately we're not allowed to use that due to supposed performance issues.
有没有定制任何其他办法/在SOAP请求添加头数据?
Are there any alternative ways of customizing/adding header data in SOAP requests?
您可以使用 SOAPHEADER
/ SoapUnknownHeader
来扩展生成的代理此:
you can use SoapHeader
/ SoapUnknownHeader
to extend the generated proxy for this:
编辑 - 按评论:
要包含自定义命名空间看样品code 这里。
To include a custom namespace see the sample code here.