1) I'm running the below code to generate an IssueRequestSeurityToken and embed
it to a SOAPMessage .. By creating the securityToken I get the tag "wst:"
for the TokenType and RequestType which is fine. Thought after generating
the SOAPMessage I get "NS1:" tag for these elements which makes me unable to
get their value later by calling getTokenType() and getRequestType() (they
always return null).
I have enclosed the related output as well .
What am I doing wrong here ??
2) What is the constant value for X509 certificates ???
Thanks for any help
Alex.
/*'''''''''''''''''''''''''''''''''''''''''''' CODE ''''*/
SOAPEnvelope reqSOAPMessage =new SOAPEnvelope();
SOAPBodyElement sbe =null;
Document requestDoc =null;
WSSConfig wssconfig =WSSConfig.getDefaultWSConfig();
IssueRequestSecurityToken requestToken =null;
try {
requestDoc =stsReqSOAPMessage.getAsDocumen
t();
requestToken =new IssueRequestSecurityToken(requestDoc);
// just for test
requestToken.setRequestType(TrustConstants.ISSUE_SECURITY_TOKEN);
requestToken.setTokenType(WSConstants.X509TOKEN_NS);
logger.debug(requestToken.toString());
sbe =new SOAPBodyElement( requestToken.getElement());
sbe.setName(SRVConstants.SRV_REQ.toString());
reqSOAPMessage.addBodyElement(sbe);
logger.debug(reqSOAPMessage.toString());
......
<wst:RequestSecurityToken xmlns:wst="
http://schemas.xmlsoap.org/ws/2005/02/trust">
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue
</wst:RequestType>
<wst:TokenType>
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-=
1.0
</wst:TokenType>
</wst:RequestSecurityToken>
<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope=
/"
xmlns:xsd=D"http://www.w3.org/2001/XMLSchema " xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" >
<soapenv:Body><ns1:RequestSecurityToken xmlns:ns1="
http://schemas.xmlsoap.org/ws/2005/02/trust">
<ns1:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue
</ns1:RequestType>
<ns1:TokenType>
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-=
1.0
</ns1:TokenType>
</ns1:RequestSecurityToken> </soapenv:Body>
</soapenv:Envelope>
requestToken =new IssueRequestSecurityToken(requestDoc);
// just for test
requestToken.setRequestType(TrustConstants.ISSUE_SECURITY_TOKEN);
requestToken.setTokenType(WSConstants.X509TOKEN_NS);
logger.debug(requestToken.toString());
sbe =new SOAPBodyElement( requestToken.getElement());
sbe.setName(SRVConstants.SRV_REQ.toString());
reqSOAPMessage.addBodyElement(sbe);
logger.debug(reqSOAPMessage.toString());
......
<wst:RequestSecurityToken xmlns:wst="
http://schemas.xmlsoap.org/ws/2005/02/trust">
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue
</wst:RequestType>
<wst:TokenType>
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-=
1.0
</wst:TokenType>
</wst:RequestSecurityToken>
<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope=
/"
xmlns:xsd=D"http://www.w3.org/2001/XMLSchema " xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" >
<soapenv:Body><ns1:RequestSecurityToken xmlns:ns1="
http://schemas.xmlsoap.org/ws/2005/02/trust">
<ns1:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue
</ns1:RequestType>
<ns1:TokenType>
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-=
1.0
</ns1:TokenType>
</ns1:RequestSecurityToken> </soapenv:Body>
</soapenv:Envelope>
