<html><head></head><body bgcolor="#FFFFFF"><div>Brent, Using org.opensaml.ws.soap.soap11.encoder.http.HTTPSOAPEncoder, I can&nbsp;<span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">generate a valid SOAP Envelope with header. I will have to do more testing with ECP client and SP to make sure everything works. Thanks!<br><br>And thanks for the pointer about the Protocol Message loggingl. I can see the messages in the log file!</span><br></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "><br></span></div><div><br>On Dec 12, 2012, at 9:06 PM, Brent Putman &lt;<a href="mailto:putmanb@georgetown.edu">putmanb@georgetown.edu</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  
    <br>
    <br>
    <div class="moz-cite-prefix">On 12/12/12 6:13 PM, Mitu Singh wrote:<br>
    </div>
    <blockquote cite="mid:1355354018.99435.YahooMailNeo@web122005.mail.ne1.yahoo.com" type="cite">
      <div style="color:#000; background-color:#fff; font-family:tahoma,
        new york, times, serif;font-size:10pt">Thanks Brent. It would be
        great help if you could look into the code to see if I need to
        change something. <br>
      </div>
    </blockquote>
    <br>
    Ok, I think I know what the issue is.&nbsp; The problem isn't the code
    that's constructing the Envelope, etc, it's the encoder that you are
    using.&nbsp; The SAML 2 binding version of HTTPSOAP11Encoder (meaning
    org.opensaml.saml2.binding.encoding.HTTPSOAP11Encoder) essentially
    doesn't currently allow using SOAP headers, because it
    indiscriminately ignores any SOAP Envelope that you set in the
    message context and instead builds its own.&nbsp; IIRC someone else
    pointed this out once and I actually thought we had fixed that, but
    apparently not.&nbsp; I'll look at doing that.<br>
    <br>
    In the meantime, just try switching to the java-openws impl of
    HTTPSOAP11Encoder which is
    org.opensaml.ws.soap.soap11.encoder.http.HTTPSOAP11Encoder.&nbsp; It
    respects the presence of a pre-existing SOAP Envelope in the message
    context's outbound message slot.&nbsp; I believe the only functional
    difference between them for your purposes is going to be that the
    SAML version sets the HTTP SOAPAction header to
    <a class="moz-txt-link-rfc2396E" href="http://www.oasis-open.org/committees/security">"http://www.oasis-open.org/committees/security"</a>, which is a MAY in
    the SAML 2 bindings spec.&nbsp; The openws one sets it to an empty
    string, unless there is a WS-Addressing Action header set on the
    Envelope, in which case it pulls the action value from that.<br>
    <br>
    In terms of code compatibility, the main difference is going to be
    that the openws one does not implement the SAMLMessageEncoder
    interface, so it doesn't expose the binding URI.<br>
    <br>
    If either or both of those things is important for your purposes,
    you could just trivially subclass the openws one and make it do
    those 2 things. <br>
    <br>
    The biggest difference is that the openws is an impl of
    HandlerChainAware, which is a concept that was introduced after the
    SAML ones in java-opensaml2 were written.&nbsp; They were never
    backported to support that stuff, and probably won't be.<br>
    <br>
    <blockquote cite="mid:1355354018.99435.YahooMailNeo@web122005.mail.ne1.yahoo.com" type="cite">
      <div style="color:#000; background-color:#fff; font-family:tahoma,
        new york, times, serif;font-size:10pt"><br>
        Also, before the message is sent I would like to output the
        message (envelope with header,body and the saml response) to the
        console. How can I achieve this? I can output just the saml
        response using:<br>
        <span class="tab">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ResponseMarshaller marshaller
        = new ResponseMarshaller();<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Element plaintextElement =
        marshaller.marshall(samlResponse);<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String responseString =
        XMLHelper.nodeToString(plaintextElement);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("SAML response: " + responseString);<br>
        <br>
        Can I do something similar to output the entire message?<br>
      </div>
    </blockquote>
    <br>
    <br>
    Yes, the message encoder and decoder impls already have this support
    built-in via special logging categories.&nbsp; Just turn on DEBUG level
    logging for Logger with name "PROTOCOL_MESSAGE" and you will get
    whatever is in the message context as the outbound or inbound
    message respectively.&nbsp; To get logging to the console or anywhere
    else you want, you just need to supply you desired logging impl of
    SLF4J (e.g logback or one of the slf4j-to-whatever adapters) and the
    appropriate configuration.<br>
    <br>
    &nbsp;<br>
    <br>
    <br>
  

</div></blockquote><blockquote type="cite"><div><span>--</span><br><span>To unsubscribe from this list send an email to <a href="mailto:dev-unsubscribe@shibboleth.net">dev-unsubscribe@shibboleth.net</a></span></div></blockquote></body></html>