You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Malinda Kaushalye <ka...@cse.mrt.ac.lk> on 2004/06/23 07:20:41 UTC

Security Token Servic-Adding elements to Security Header

Hi All,

I am coding the following method body in SecurityTokenServieBindingImpl.java (generated using http://schemas.xmlsoap.org/ws/2004/04/trust/ws-trust.wsdl ).

public org.xmlsoap.schemas.ws._2004._04.trust.RequestSecurityTokenResponseType requestSecurityToken(org.xmlsoap.schemas.ws._2004._04.trust.RequestSecurityTokenType request) throws java.rmi.RemoteException {
 //----
}

I want to add a element to the security header as the sample response shown below within the Impl(i.e here I can't use Handlers). How can I do it?

Thanks 
Kaushalye

sample response: 
<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <RequestSecurityTokenResponse xmlns="http://schemas.xmlsoap.org/ws/2004/04/trust">
            <RequestedSecurityToken>
               <ns1:SecurityTokenReference xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                  <ns1:Reference URI="#myToken"/>
               </ns1:SecurityTokenReference>
            </RequestedSecurityToken>
            <RequestedProofToken/>
            <Lifetime>
               <Created>2004-06-23T04:28:10Z</Created>
               <Expires>2004-06-23T05:28:10Z</Expires>
            </Lifetime>
         </RequestSecurityTokenResponse>
      </soapenv:Body>
   </soapenv:Envelope>


Re: Security Token Servic-Adding elements to Security Header

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Please send these messages to fx-dev@ws.apache.org .. not to the
-cvs list.

If you are adding headers to a Call object the following works:

Create the headers:
------------------
    SOAPHeaderElement replyToHeader =
      new
SOAPHeaderElement("http://schemas.xmlsoap.org/ws/2003/03/addressing",
                            "ReplyTo");
    replyToHeader.addChild
      (new MessageElement
("http://schemas.xmlsoap.org/ws/2003/03/addressing",
                           "Address",

(Object)"http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous"));

Add to the call:
---------------
      Service  service = new Service();
      Call  call = (Call) service.createCall();
      call.setSOAPVersion (SOAPConstants.SOAP12_CONSTANTS);
      call.setTargetEndpointAddress( new java.net.URL(endpoint) );
      call.addHeader (toHeader);
      call.addHeader (actionHeader);
      call.addHeader (replyToHeader);

I think you can do something similar in the response ..

What do you mean "within the impl"?? You don't mean the application
code right?

Sanjiva.

----- Original Message ----- 
From: Malinda Kaushalye
To: ws-fx-cvs@apache.org
Cc: sanjiva@opensource.lk ; ruchith3@cse.mrt.ac.lk ; muthulee@cse.mrt.ac.lk
; chamindra@virtusa.com
Sent: Wednesday, June 23, 2004 11:20 AM
Subject: Security Token Servic-Adding elements to Security Header


Hi All,

I am coding the following method body in SecurityTokenServieBindingImpl.java
(generated using
http://schemas.xmlsoap.org/ws/2004/04/trust/ws-trust.wsdl ).

public
org.xmlsoap.schemas.ws._2004._04.trust.RequestSecurityTokenResponseType
requestSecurityToken(org.xmlsoap.schemas.ws._2004._04.trust.RequestSecurityT
okenType request) throws java.rmi.RemoteException {
 //----
}

I want to add a element to the security header as the sample response shown
below within the Impl(i.e here I can't use Handlers). How can I do it?

Thanks
Kaushalye

sample response:
<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <RequestSecurityTokenResponse
xmlns="http://schemas.xmlsoap.org/ws/2004/04/trust">
            <RequestedSecurityToken>
               <ns1:SecurityTokenReference
xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-secext-1.0.xsd">
                  <ns1:Reference URI="#myToken"/>
               </ns1:SecurityTokenReference>
            </RequestedSecurityToken>
            <RequestedProofToken/>
            <Lifetime>
               <Created>2004-06-23T04:28:10Z</Created>
               <Expires>2004-06-23T05:28:10Z</Expires>
            </Lifetime>
         </RequestSecurityTokenResponse>
      </soapenv:Body>
   </soapenv:Envelope>