使用基于SOAP的方法与WSDL而不是添加服务引用 [英] Using SOAP based approach with WSDL instead of adding service reference

查看:159
本文介绍了使用基于SOAP的方法与WSDL而不是添加服务引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

0
向下投票

收藏

我正在尝试创建SOAP请求,而不是添加生成代理类的服务引用。面临的主要挑战是身份验证部分。服务提供商有2个URL 1)安全令牌服务[STS] 2)为某些功能调用的主要服务。



服务提供商向我们发放了公共证书(X.509)。这需要在对STS进行调用时传递。然后,该服务向我们发送SAML令牌,该令牌需要成为主服务请求的一部分。



通过添加服务参考方法,我们只需要轻松实现创建自定义绑定对象,其中设置了与身份验证相关的所有必需属性。然后将此绑定对象作为参数与端点地址一起传递给代理类对象。然后使用证书设置代理类对象。一旦设置了证书和绑定对象,就会调用所需的API。



例如:

0 down vote
favorite
I am trying to create a SOAP request instead of adding service reference that generates proxy classes. The main challenge am facing is with Authentication part. The service provider has 2 URLs 1) Security Token Service [STS] 2) Main service to be called for certain functionality.

The service provider has issued us the public certificate(X.509). This needs to be passed when a call is made to the STS. This service then issues us the SAML token which needs to be part of request to the main service.

With adding service reference approach it was easy to achieve as we just need to create a custom binding object where all the necessary properties are set related to authentication. This binding object was then passed as a parameter along with endpoint address to the proxy class object. Then the proxy class object is set with the certificate. A desired API is called once the certificate and binding object is set.

eg:

ServiceClient client = new ServiceClient(binding, endpointAddress); Client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByIssuerName, IssuerName); client.CallServiceAPI();





执行时如果我们查看fiddler工具,我们有2个请求发送一个用于STS和主服务。



通过基于SOAP的方法实现这一目标的挑战。任何关于此的建议或建议都非常感谢。



我尝试过:



我试图根据fiddler请求结构创建请求。但我最终得到内部服务器错误500.



On execution if we look at the fiddler tool, we have 2 requests sent one for STS and main service.

Am finding challenge in achieving this via SOAP based approach. Any pointers or suggestions on this is much appreciated.

What I have tried:

I have tried to create request based on the fiddler request structure. But i end up getting internal server error 500.

推荐答案

你好Abhishek,



为什么不您尝试使用 SoapUI 等第三方工具来测试您的肥皂服务吗?

您无法传递Soap标头由提琴手服务。所以,这个工具可能对您有所帮助。



一切顺利。





注意:如果对您有帮助,请标记为已回答。
Hello Abhishek,

why don't you try some third party tool like SoapUI to test your soap services?
You can't pass Soap headers in service by fiddler. So, this tool may be helpful for you.

All the best.


Note: Please mark as answered if helpful for you.


这篇关于使用基于SOAP的方法与WSDL而不是添加服务引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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