Adding Security Credentials to SOAP
The WSE 3.0 for .NET enables the developers for creating one or more security credentials that can be added to the SOAP Message.
The following procedure describes how to add one or more security credentials to a SOAP Message.A computer must be configured to accept the SOAP Messages embedded with the security credentials.
Two types of security credentials that can be setup for the computer
- X.509 certificate.
- Username and Password.
You can configure the computer for X.509 certificate by reading the SOAP Messages signed by an X.509 Certificate.
You can also configure the computer for Username Token by validating SOAP Messages signed by Username Token.
Following procedure is To Add a security token to SOAP
1. Open the Web Service Client project
2.Add references to the Microsoft.Web.Services3 and System.Web.Services assemblies.
3. Add a Web Reference to the Web service that is to receive the SOAP message signed with the UsernameToken.
4. Add the folllowing user directives
using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography.X509Certificates; using Microsoft.Web.Services3; using Microsoft.Web.Services3.Design; using Microsoft.Web.Services3.Security; using Microsoft.Web.Services3.Security.Tokens;
5. Write the following code by overriding the SecureMessage Method in web service.
public override void SecureMessage(SoapEnvelope envelope, Security security) {UsernameToken userToken; userToken = new UsernameToken(userName, userPasswordEquivalent, PasswordOption.SendNone);// Adds the token to the SOAP header. security.Tokens.Add(userToken);}
Related Posts:
More from kalyan
- Digital Signing the SOAP Message
- SOAP Fundamentals
- Configure WSE to Validate SOAP Message
- Service-Oriented Architecture(SOA)
- MTOM Support to Web Service
kalyan Recommends
2 Comments so far
Leave a reply
![Recommend [kalyanms1]](http://s3.amazonaws.com/arkayne-media/img/badge/logo-recommend-badge-medium.png)
[...] to be routed to so many intermediaries before reaching the receiver. We can address this problem by Adding Security Credentials to SOAP Message.Alternatively we can digitalsign a SOAP Message using [...]
Adding Security Credentials to SOAP…
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com…