Missing SOAP header in ECP response
Mitu Singh
mitusingh27 at yahoo.com
Wed Dec 12 18:13:38 EST 2012
Thanks Brent. It would be great help if you could look into the code to see if I need to change something.
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:
ResponseMarshaller marshaller = new ResponseMarshaller();
Element plaintextElement = marshaller.marshall(samlResponse);
String responseString = XMLHelper.nodeToString(plaintextElement);
System.out.println("SAML response: " + responseString);
Can I do something similar to output the entire message?
________________________________
From: Brent Putman <putmanb at georgetown.edu>
To: dev at shibboleth.net
Sent: Wednesday, December 12, 2012 2:22 PM
Subject: Re: Missing SOAP header in ECP response
On 12/12/12 12:43 PM, Mitu Singh wrote:
>
>I have tried a number of ways to include the header, but it is not being set. This is how I have done it:
> HttpServletResponseAdapter
outTransport = new HttpServletResponseAdapter(httpResponse, false);
>
>BasicSAMLMessageContextmessageContext = new BasicSAMLMessageContext();
>
messageContext.setOutboundMessageTransport(outTransport);
>
SOAPObjectBuilder<Envelope> envelopeBuilder = (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
> Envelope envelope = envelopeBuilder.buildObject();
> messageContext.setOutboundMessage(envelope);
> messageContext.setOutboundSAMLMessage(authResponse);
>
SAMLObjectBuilder<org.opensaml.saml2.ecp.Response> ecpResponseBuilder =
(SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>)
builderFactory.getBuilder(org.opensaml.saml2.ecp.Response.DEFAULT_ELEMENT_NAME);
>
org.opensaml.saml2.ecp.Response ecpResponse = ecpResponseBuilder.buildObject();
>
ecpResponse.setSOAP11MustUnderstand(true);
>
ecpResponse.setSOAP11Actor(org.opensaml.saml2.ecp.Response.SOAP11_ACTOR_NEXT);
>
ecpResponse.setAssertionConsumerServiceURL("https://localhost:8443/sp_URL");
>
SOAPHelper.addHeaderBlock(messageContext, ecpResponse);
>
Off-hand, this approach looks more or less correct, at least in
broad strokes. But since it isn't working, there must be something
subtly wrong. I have to run out the door soon, but I will later try
and take a closer look and see if I can spot what it is.
And
another way:
>SOAPObjectBuilder<Envelope>
envelopeBuilder = (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
> Envelope envelope =
envelopeBuilder.buildObject();
> SOAPObjectBuilder<Header>
headerBuilder = (SOAPObjectBuilder<Header>) builderFactory.getBuilder(Header.DEFAULT_ELEMENT_NAME);
> Header header = headerBuilder.buildObject();
> SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>
ecpResponseBuilder = (SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>)
builderFactory.getBuilder(org.opensaml.saml2.ecp.Response.DEFAULT_ELEMENT_NAME);
>
org.opensaml.saml2.ecp.Response ecpResponse = ecpResponseBuilder.buildObject();
> ecpResponse.setSOAP11MustUnderstand(true);
>
ecpResponse.setSOAP11Actor(org.opensaml.saml2.ecp.Response.SOAP11_ACTOR_NEXT);
>
ecpResponse.setAssertionConsumerServiceURL("https://localhost:8443/sp");
>
header.getUnknownXMLObjects().add(ecpResponse);
> envelope.setHeader(header);
> messageContext.setOutboundMessage(envelope);
> messageContext.setOutboundSAMLMessage(authResponse);
This also looks off-hand correct, but again there must be some
trivial thing that is being omitted or something (or possibly we
have a bug somewhere.
--
To unsubscribe from this list send an email to dev-unsubscribe at shibboleth.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20121212/663dc551/attachment-0001.html
More information about the dev
mailing list