You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Bill Price <wp...@mitre.org> on 2005/04/26 20:19:54 UTC

Newbie question: Difficulties creating and serializing SOAP message

I am having trouble getting my "client" program to create a SOAP message
whose body is a SAML Request based on an attribute query created using
OpenSAML and whose header includes a SAML authentication assertion. I
suspect my problem has to do with underlying document providers
(implementations). I am not able to place the assertion in the SOAPHeader or
the request in the SOAPBody. A code snippet is below with debugging print
statements. All the print statements print the same- a SOAP message skeleton
without a header. Examining the header and body from the Eclipse debugger, I
see that the header and body seem aware of the appends. The children of the
header and body show [[Assertion:null]...] and [[Request:null]...]
respectively. 
 
My imports are from javax.xml.soap.*.  I included the axis jar in the
classpath and believe I am using the axis implementation of SOAP messages.
 
 
The code snippet is:
  MessageFactory msgFactory = MessageFactory.newInstance();
  message = msgFactory.createMessage();
  
  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(req.toDOM());
  System.out.println("Envelope3:  "+"\n"+se.toString());


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

Bill Price