Click here to Skip to main content
15,883,896 members
Home / Discussions / C#
   

C#

 
GeneralRe: Stack trace Pin
BoneSoft5-Jul-06 3:47
BoneSoft5-Jul-06 3:47 
QuestionAccessing Frames within WebBrowser component Pin
Dave_Roach4-Jul-06 8:56
Dave_Roach4-Jul-06 8:56 
QuestionMenu Choise Pin
ytubis4-Jul-06 7:24
ytubis4-Jul-06 7:24 
AnswerRe: Menu Choise Pin
Jun Du4-Jul-06 8:09
Jun Du4-Jul-06 8:09 
GeneralRe: Menu Choise Pin
ytubis4-Jul-06 8:40
ytubis4-Jul-06 8:40 
GeneralRe: Menu Choise Pin
Jun Du4-Jul-06 9:25
Jun Du4-Jul-06 9:25 
GeneralRe: Menu Choise Pin
Jun Du4-Jul-06 14:18
Jun Du4-Jul-06 14:18 
QuestionWSD 3.0 UsernameToken (Sign a SOAP Message by Using a UserName and Password ) Pin
okoji Cyril4-Jul-06 6:30
okoji Cyril4-Jul-06 6:30 
Pls can any help me figure out if there is any error in this web sevcice client. I have included Username and Password for testing. When

http://dedicated134.eapps.com/pencomweb2/PENCOM_WebService.asmx is registered
classes exposed are:

PencomServer2.PENCOM_WebService c1 = new PencomServer2.PENCOM_WebService();
PencomServer2.RSANO_Response c2 = new PencomServer2.RSANO_Response();
PencomServer2.EmployeeRecord[] record=new PencomServer2.EmployeeRecord[2];

but of tesing purposes
(string r = c1.TestPenComService();)
can be used.

Sample code is:

required namespace are:

using Microsoft.Web.Services3;
using Microsoft.Web.Services3.Design;// formerly Microsoft.Web.Services3.Policy
using System.Security.Permissions;
using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;

public void ReadData()
{

//Secure Service
//http://dedicated134.eapps.com/pencomweb2/PENCOM_WebService.asmx
// Create an instance of the Web service proxy

PencomServer2.PENCOM_WebService c1 = new PencomServer2.PENCOM_WebService();
PencomServer2.RSANO_Response c2 = new PencomServer2.RSANO_Response();
PencomServer2.EmployeeRecord[] record=new PencomServer2.EmployeeRecord[2];



// This is the username security token which is used by the service proxy
UsernameToken token = null;

Username = "PENSUREPFA";
Password = "NS946343PE";

byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes(Password);
string passwordEquivalent = Convert.ToBase64String(passwordBytes);

token = new UsernameToken(Username, passwordEquivalent, PasswordOption.SendHashed);

//PolicyEnforcementSecurityTokenCache.GlobalCache.Add(token); //wse3.0

//Get the SoapContext for the SOAP request that is being made to the Web service.

Microsoft.Web.Services3.SoapContext requestContext = c1.RequestSoapContext;

//Add the UsernameToken to the WS-Security SOAP header.
requestContext.Security.Tokens.Add(token);

//Encrypt the UsernameToken in the WS-Security SOAP header.
//X509SecurityToken serverToken = GetSecurityToken();
//requestContext.Security.Elements.Add(new EncryptedData(serverToken, "#" + token.Id));

//Create a new instance of the MessageSignature class by using
//the UsernameToken just added to the WS-Security SOAP header.
MessageSignature sig = new MessageSignature(token);

//Add the digital signature to the WS-Security SOAP header.
requestContext.Security.Elements.Add(sig);

//Specify the time-to-live (TTL) for the
//SOAP message to diminish the chance of someone
//intercepting the message and replaying it.
requestContext.Security.Timestamp.TtlInSeconds = 120;



//Call the Web service.
//c1.UploadEmployeesRecordToGetRSANos(record, 0023);
try
{

string r = c1.TestPenComService(); //test version
}
catch (Exception g)
{
MessageBox.Show(g.Message);
}

}

On trying to connect to a test method, the respose I get back is:

Microsoft.Web.Services2.Security.SecurityFault: The security token could not be authenticated or authorized ---> System.Exception: WSE563:
The computed password digest doesn't match that of the incoming username token.
at Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.VerifyHashedPassword(UsernameToken token, String authenticatedPassword)
at Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.VerifyPassword(UsernameToken token, String authenticatedPassword)
at Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.VerifyToken(SecurityToken securityToken)
at Microsoft.Web.Services2.Security.Tokens.SecurityTokenManager.LoadXmlSecurityToken(XmlElement element)
--- End of inner exception stack trace ---
at Microsoft.Web.Services2.Security.Tokens.SecurityTokenManager.LoadXmlSecurityToken(XmlElement element)
at Microsoft.Web.Services2.Security.Tokens.SecurityTokenManager.GetTokenFromXml(XmlElement element)
at Microsoft.Web.Services2.Security.Security.LoadToken(XmlElement element, SecurityConfiguration configuration, Int32& tokenCount)
at Microsoft.Web.Services2.Security.Security.LoadXml(XmlElement element)
at Microsoft.Web.Services2.Security.SecurityInputFilter.ProcessMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.Pipeline.ProcessInputMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.WebServicesExtension.BeforeDeserializeServer(SoapServerMessage message)

Magic has often been thought of us the art of making dreams come true; the art of realizing visions. Yet before we can bring birth to the vision we have to see it.

QuestionHow to select a specific cell in DataGridView Pin
Nigor4-Jul-06 5:42
Nigor4-Jul-06 5:42 
QuestionShadow copy in .net windows forms Pin
kokilambal.p4-Jul-06 4:54
kokilambal.p4-Jul-06 4:54 
AnswerRe: Shadow copy in .net windows forms Pin
Paul Conrad4-Jul-06 14:07
professionalPaul Conrad4-Jul-06 14:07 
QuestionHow to create a trafic program Pin
Halawlaws4-Jul-06 4:02
Halawlaws4-Jul-06 4:02 
AnswerRe: How to create a trafic program Pin
stancrm4-Jul-06 4:06
stancrm4-Jul-06 4:06 
GeneralRe: How to create a trafic program Pin
Halawlaws4-Jul-06 4:15
Halawlaws4-Jul-06 4:15 
GeneralRe: How to create a trafic program Pin
Jun Du4-Jul-06 4:20
Jun Du4-Jul-06 4:20 
GeneralRe: How to create a trafic program Pin
Halawlaws4-Jul-06 4:32
Halawlaws4-Jul-06 4:32 
GeneralRe: How to create a trafic program Pin
Jun Du4-Jul-06 5:55
Jun Du4-Jul-06 5:55 
GeneralRe: How to create a trafic program Pin
stancrm4-Jul-06 19:56
stancrm4-Jul-06 19:56 
QuestionPl help me in this issue Pin
Arun Hegde4-Jul-06 3:21
Arun Hegde4-Jul-06 3:21 
AnswerRe: Pl help me in this issue Pin
ketankumar4-Jul-06 3:32
ketankumar4-Jul-06 3:32 
QuestionConverting a string to a DateTime object (globalization question) [modified] Pin
Vikram A Punathambekar4-Jul-06 3:08
Vikram A Punathambekar4-Jul-06 3:08 
AnswerRe: Converting a string to a DateTime object (globalization question) Pin
stancrm4-Jul-06 3:16
stancrm4-Jul-06 3:16 
AnswerRe: Converting a string to a DateTime object (globalization question) Pin
Andrei Ungureanu4-Jul-06 4:37
Andrei Ungureanu4-Jul-06 4:37 
GeneralRe: Converting a string to a DateTime object (globalization question) Pin
Vikram A Punathambekar4-Jul-06 5:06
Vikram A Punathambekar4-Jul-06 5:06 
AnswerRe: Converting a string to a DateTime object (globalization question) Pin
J4amieC4-Jul-06 5:02
J4amieC4-Jul-06 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.