One header should be fine for most cases, but it could be a Collection to allow for multiple headers. Maybe best to allow for both - detect if an instanceof Collection and if so, then iterate over it?
I'll change what I've done to use the type converters. Cheers, Damian. -----Original Message----- From: Claus Ibsen [mailto:claus.ib...@gmail.com] Sent: Monday, 24 October 2011 11:03 PM To: users@camel.apache.org Subject: Re: Setting SOAP Headers using spring-ws On Mon, Oct 24, 2011 at 5:18 AM, Damian Harvey <damian.har...@aon.com> wrote: > Hi all, > > I've another SOAP spring-ws question for you. > > Currently I can't see a way to dynamically set SOAP headers using spring-ws. > I can set static headers by creating a MessageFactory but I see no way to > pass values into it. Is this currently possible? > > It looks like the recommended approach for spring-ws is to override the > doWithMessage() method of the WebServiceMessageCallback > (http://static.springsource.org/spring-ws/site/reference/html/client.html#d4e1822). > The Camel SpringWebserviceProducer already does this and I can't see an > obvious way to override it. I see two options: > > 1. Allow for the WebServiceMessageCallback to be overridden so that the > developer can provide his own doWithMessage() method. > 2. Have a Camel header for SPRING_WS_SOAP_HEADER that expects a value of type > javax.xml.transform.Source and is added to the SOAP Header in the > doWithMessage() method of the DefaultWebserviceMessageCallback. > > Which approach is better? > Would there be needs to set 2+ soap headers? Or should only 1 SPRING_WS_SOAP_HEADER be enough? And must the type be a Source? You can use the Camel type converter system, and convert the value to a source. Then people can set a plain String as value. > Happy to create a JIRA and I've already written a patch following approach #2. > Great we love contributions http://camel.apache.org/contributing.html > Thanks, > > Damian. > > ________________________________ > > > This communication (and any attachments) is directed in confidence to the > addressee(s) listed above, and may not otherwise be distributed, copied or > used. The contents of this communication may also be subject to privilege, > and all rights to that privilege are expressly claimed and not waived. If you > have received this communication in error, please notify us by reply e-mail > or by telephone and delete this communication (and any attachments) without > making a copy. > > Before opening or using attachments, you should check them for viruses and > defects. We do not accept liability in connection with computer virus, data > corruption, delay, interruption, unauthorised access or unauthorised > amendment. > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ ________________________________ This communication (and any attachments) is directed in confidence to the addressee(s) listed above, and may not otherwise be distributed, copied or used. The contents of this communication may also be subject to privilege, and all rights to that privilege are expressly claimed and not waived. If you have received this communication in error, please notify us by reply e-mail or by telephone and delete this communication (and any attachments) without making a copy. Before opening or using attachments, you should check them for viruses and defects. We do not accept liability in connection with computer virus, data corruption, delay, interruption, unauthorised access or unauthorised amendment.