Building soap12 envelop

Brent Putman putmanb at georgetown.edu
Thu Mar 29 23:53:52 BST 2012



On 3/29/12 3:30 PM, Gina Choi wrote:
> I don't see an Envelop class under org.opensaml.ws.soap.soap12. 


No, we have not yet implemented SOAP 1.2 support in OpenSAML 2.x. It
will be in 3.x, but that doesn't help you.



>So, I created
> soap12 envelope using following code. Same way, I created Header and Body for
> soap12, but it doesn't seem right. When I try marshal the Envelope, I am
> getting null pointer exception. Is there other way to create soap12 envelope?
> 
> 
> 		XMLObjectBuilderFactory builderFactory = Configuration
> 				.getBuilderFactory();
> 
> 		EnvelopeBuilder envelopeBuilder = (EnvelopeBuilder)
> builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
> 		
> 		org.opensaml.ws.soap.soap11.Envelope envelope =
> envelopeBuilder.buildObject(new QName(SOAPConstants.SOAP12_NS,
> Envelope.DEFAULT_ELEMENT_LOCAL_NAME, SOAPConstants.SOAP12_PREFIX));
> 


That's not really correct.  You might be able to kludge it to get a SOAP
1.2 Envelope emitted via the 1.1 object providers, but it won't be
pretty, and it won't help for the received message, which OpenSAML won't
know about because it doesn't have any providers registered for those
QNames.

You can theoretically use the all-purpose XSAny provider, but that's not
much better, and I think you'll have problems trying to use the SOAP
client with that.

The really correct way is to just implement the 1.2 providers and
register them in your config.  There's only half a dozen or so.  That's
more complicated, but it's the correct way.  The developer's guide might
be helpful there:

https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoDeveloperManual


But for the most part I think you can just copy the 1.1 classes and
change the namespaces and prefixes. I think you'll also have to subclass
or copy and change or reimplement the SOAP client and related classes,
since I think it assumes a SOAP 1.1 Envelope.


More information about the dev mailing list