Skip to Content.
Sympa Menu

mace-opensaml-users - Newbie question: ClassCastException trying to bind SAML Request to SOAP

Subject: OpenSAML user discussion

List archive

Newbie question: ClassCastException trying to bind SAML Request to SOAP


Chronological Thread 
  • From: "Bill Price" <>
  • To: <>
  • Subject: Newbie question: ClassCastException trying to bind SAML Request to SOAP
  • Date: Fri, 22 Apr 2005 10:54:08 -0400
  • Organization: The MITRE Corporation

I am having trouble trying to get my program to create a SOAP message that carries a SAMLRequest based on an attribute query. I am not able to place the request in a SOAPBody. A code snippet is below with debugging print statements. The SOAP message displays fine in the Eclipse debugger until I try to add the request to the body. After appending the child to the body, the soap message no longer displays when the envelope variable is highlighted/selected. The printout for Envelope1 is a SOAP message skeleton that has no header attribute. The printout for Envelope2 adds the header element with the child SAML Assertion. In both printouts, the body element is: <soapenv:Body/>. Execution of the line to print Envelope 3 results in:
 
- Exception:
java.lang.ClassCastException
 at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:138)
 at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:485)
 at org.apache.axis.message.MessageElement.output(MessageElement.java:1207)
 at org.apache.axis.message.MessageElement.getAsString(MessageElement.java:1110)
 at org.apache.axis.message.MessageElement.toString(MessageElement.java:1271)
 at pASRequest.PASRequest.<init>(PASRequest.java:89)
 at pASRequest.PASRequest.<init>(PASRequest.java:134)
 at pASRequest.PASRequest.main(PASRequest.java:211)
Envelope3: 
 
The code snippet is:
  samlToken=sas; //SAML Authentication Assertion
  samlQuery=saq; //SAML Attribute Query
  SAMLRequest req = new SAMLRequest(null,samlQuery,null, null);
  SOAPPart part=message.getSOAPPart();
  SOAPEnvelope se=part.getEnvelope();
  SOAPHeader hdr = se.getHeader();
  
  SOAPBody body = se.getBody();
  System.out.println("Envelope1:  "+"\n"+se.toString());
  hdr.appendChild(samlToken.toDOM());
  System.out.println("Envelope2:  "+"\n"+se.toString());
  body.appendChild(((SAMLObject)req).toDOM());
  System.out.println("Envelope3:  "+"\n"+se.toString());

Thanks.
============================================

Bill Price

 



Archive powered by MHonArc 2.6.16.

Top of Page