为CXF Web服务的.NET客户端身份验证和SOAP凭证头

情景

我有一个.NET客户端来访问Web服务。
该服务是一个Apache CXF Web服务。
用户名和密码验证是必需的。
我创建了代理。
我已经设置了证书。

I have to access a web service with a .NET client. The service is an Apache CXF Web Service. Username and password authentication is required. I have created the proxy. I have set up the credential.

MyServiceReference proxy = new MyServiceReference();
proxy.Credentials = new NetworkCredential("username", "password");
string res = proxy.Method1();

当我运行客户端,下面抛出异常:

When I run the client, the following exception is thrown:

System.Web.Services.Protocols.SoapHeaderException: An error was discovered processing the <wsse:Security> header

该服务发行商告诉我,凭据不在SOAP头present。
所以,我想这 IWebProxy.Credentials 是不成立的认证的正确方法。

The service publisher told me that the credentials are not present in the SOAP headers. So, I guess that IWebProxy.Credentials is not the correct way to set up the authentication.

所以,我怎么可以设置为验证所需的SOAP头?

So, how can I set up the SOAP header required for the authentication?



 1 条回答