Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I want to use a java web service fuction in a .net client program.
In .net 2 (by using WSE 3.0) I use this code to set the user name token and connect to web service
C#
Service serviceProxy = new Service();
UsernameToken usernameToken = new UsernameToken("user", "password");
serviceProxy.SetClientCredential(usernameToken);
serviceProxy.SetPolicy("ClientPolicy");
serviceProxy.getTransactionByBillIdAndPayId(); 

that work OK in .net 2.0 and when I wanted to migrate to .net 4.0 using WCF I try this code to connect to the web service.
C#
TransactionService.TransactionService proxy = new TransactionService.TransactionService();
String result = proxy.getTransactionByBillIdAndPayId(Convert.ToInt64(9916993302560), Convert.ToInt64(34530065));

the error "Invalid User Name Or Password" was occured when I run the code.
It seems that the username token was not set for the request.

the question is:
by which classes do I can send username token to the service?

regards
Reza Moghadas
Posted
Updated 25-May-14 2:02am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900