Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2006

Tip: Looking for answers? Try searching our database.

Add a <wst:RequestSecurityToken> to soap message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gustav - 09 Feb 2006 10:31 GMT
Hi!

I'm supposed to generate a SOAP-message with the structure shown below. It
is the initial message in the secureconversation standard.

I wonder how I add the RequestSecurityToken to my SoapMessage using WSE?


<?xml version="1.0" encoding="utf-8"?>
<log>
 <soap:Envelope
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
     
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/04/security/trust/RST/SCT</wsa:Action>
     <wsa:MessageID>uuid:71f015d6-9f6f-4e66-a3de-5588e4033322</wsa:MessageID>
     <wsa:ReplyTo>    
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>https://webservice.ashx</wsa:To>
     <wsse:Security>
       <wsu:Timestamp
wsu:Id="Timestamp-d8a7cf6c-3c9e-4897-9f0b-a15d01c6c992">
         <wsu:Created>2004-09-29T16:08:11Z</wsu:Created>
         <wsu:Expires>2004-09-29T16:13:11Z</wsu:Expires>
       </wsu:Timestamp>
     </wsse:Security>
   </soap:Header>
   <soap:Body>
     <wst:RequestSecurityToken
xmlns:wst="http://schemas.xmlsoap.org/ws/2004/04/trust">      
<wst:TokenType>http://schemas.xmlsoap.org/ws/2004/04/security/sc/sct</wst:TokenType>
   
<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>
       <wst:LifeTime>
         <wsu:Expires>2004-09-29T20:08:11Z</wsu:Expires>
       </wst:LifeTime>
     </wst:RequestSecurityToken>
   </soap:Body>
 </soap:Envelope>
Pablo Cibraro - 09 Feb 2006 14:43 GMT
Hi,

You can use the Microsoft.Web.Services3.Security.SecurityTokenRequest class.
(I am not sure if this class is available in previous WSE versions)
WSE automatically serializes this class as the message you are looking for.

Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax
http://www.lagash.com

> Hi!
>
[quoted text clipped - 39 lines]
>    </soap:Body>
>  </soap:Envelope>
Gustav - 09 Feb 2006 15:06 GMT
Hi!

How do I accomplish this using WSE 2.0?

/ Gustav

unfortuna

> Hi,
>
[quoted text clipped - 50 lines]
> >    </soap:Body>
> >  </soap:Envelope>
Gustav - 09 Feb 2006 17:20 GMT
I hope you refer to the RequestSecurityToken wich exist in both WSE2.0 and
WSE3.0?

Anyhow to start the securconversation  and recieve a RSTR I do the
following(see code below) but I get the following exception:

An unhandled exception of type
'Microsoft.Web.Services2.AsynchronousOperationException' occurred in
microsoft.web.services2.dll

Additional information: WSE101: An asynchronous operation raised an exception.

//Create proxy for the tokenService
SecurityTokenServiceClient stsProxy = new SecurityTokenServiceClient(new
Uri(https://webservice));
//Create the security token request
RequestSecurityToken rst = new
RequestSecurityToken("http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue");
//Request the token from the Issuer
RequestSecurityTokenResponse response = stsProxy.IssueSecurityToken(rst);

Appriciate any comments on what the problem could be.

/ Gustav

> Hi,
>
[quoted text clipped - 50 lines]
> >    </soap:Body>
> >  </soap:Envelope>
Pablo Cibraro - 10 Feb 2006 13:23 GMT
Gustav,
Do you have additional information about the error ? I mean, WSE usually
logs the complete error in the eventlog.
Your code seems to be ok.

Regards,
Pablo Cibraro.

>I hope you refer to the RequestSecurityToken wich exist in both WSE2.0 and
> WSE3.0?
[quoted text clipped - 80 lines]
>> >    </soap:Body>
>> >  </soap:Envelope>
Gustav - 01 Mar 2006 12:56 GMT
the application log says:

WSE050: The following exception was encountered:
System.InvalidOperationException: Private Key is not available
  at
Microsoft.Web.Services2.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[] ciphertext, Boolean useOAEP)
  at
Microsoft.Web.Services2.Security.Cryptography.RSA15KeyExchangeFormatter.DecryptKey(Byte[] cipherKey)
  at Microsoft.Web.Services2.Security.EncryptedKey.Decrypt()
  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).

For more information, see Help and Support Center at

> Gustav,
> Do you have additional information about the error ? I mean, WSE usually
[quoted text clipped - 88 lines]
> >> >    </soap:Body>
> >> >  </soap:Envelope>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.