Java and. NET based ws-security Web Services integration implementation
Rottenapple
This article applies to readers:
WEB Services Developers
Knowledge to be possessed:
Using vs.net2003 +wse to develop Web Services, you can use JBUILDER9 to develop simple Java applications.
One: Content Introduction
Ws-security describes SOAP messaging enhancements that provide quality protection through message integrity, message confidentiality, and individual message authentication. Applicable to the following occasions:
1. The customer must be able to determine which person the message came from and be able to verify that the sender was the sender of the sender's claim.
2. The customer must be able to determine that the transmitted data has not been tampered with.
This article describes how to implement an integrated invocation of a Java client program based on the Ws-security protocol and A. NET Web services.
Second: Platform and tools
Operating system: Win2000 Server
Software: vs.net2003+wse1.0 SP1
Jbuilder9
axis-wsse-1.0 (Axis-implemented ws-security)
Three: Realize
1. Open vs.net2003 and create a new ASP.net Web services project. Add a Web Services page called Sumservice, whose core code is as follows:
throw new ApplicationException ("Only SOAP requests are permitted.");
return a+b;
}
2. Use the WSE Setting Tool to configure this ASP Web service to use the WSE feature and add a password provision Class (PasswordProvider) in the security options bar to achieve ws-security security authentication. Also, the trace feature is selected for tracking the SOAP information that this Web services receives to request SOAP information and returns.
3. Add a Microsoft.Web.Services reference, add a new class, named PasswordProvider, which implements the IPasswordProvider interface in WSE, Used to provide ws-security user authentication capabilities. The core code is as follows:
public class Passwordprovider:ipasswordprovider
{
Public PasswordProvider ()
{
//
Todo:add constructor Logic here
//
}
public string GetPassword (UsernameToken token)
{
if (token. Username = = "Username")
{
return "password";
}
Else
{
Return to "Love";
}
}
}
Thus, a Web services that implements the UsernameToken in Ws-security is basically implemented. It is recommended that. NET be used to develop a client for testing, and then the corresponding Java client program will be developed before the test succeeds. (How to develop see my previous article on WSE or go to Microsoft MSDN)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.