Thanks Freeman

That makes much more sense now.  I found the following reference on another 
site that may be of use to anyone else reading this [1].

I have not got things working fully as I have had to modify a local copy of the 
WSDL that was actually supplied with the service due to another issue I am 
having [2], but after your answer I now know what I'm aiming for.

I will update this mailing list post if I find anything else I think would be 
useful to anyone reading this.

Thanks

Ben



[1] http://www.intalio.org/confluence/pages/viewpage.action?pageId=1485
[2] http://www.nabble.com/Error-Parsing-WSDL-with-CXF-BC-td24754492ef12049.html
 



-----Original Message-----
From: Freeman Fang [mailto:[email protected]] 
Sent: 04 August 2009 10:36
To: [email protected]
Subject: Re: Adding SoapHeader Information using CXF-BC Provider

Hi,

This testcase is that first send message
<message>
   <part>
      <greetMe>
         <requestType>header test</requestType>
      </greetMe>
   </part>
</message>
to a cxf se endpoint, then this cxf se endpiont parse the requestType  
and send different request to different cxf bc provider according to  
different requestType, in this case, the header test will send to  
provider defined in [1]
<cxfbc:provider wsdl="/HelloWorld-DOC.wsdl"
                             locationURI="http://localhost:9003/helloWorld 
"
                             endpoint="HelloPortProxy"
                             service="hello:HelloService"
                             interfaceName="hello:HelloPortType"
                     >

you can see the in HelloWorld-DOC.wsdl[2], the binding part has soap  
header definition.
The cxf bc provider will parse the incoming message and based on the  
servicemodel(built from the wsdl), put soap header and soap body  
correctly.
In your case,   you should add headers before the body part.
like
<message>
   <part>
      <SecretToken>
   </part>
   <part>
      <SelectAllFundsAsList/>
   </part>
</message>
Ensure you have correct namespace same as the one in you wsdl.

[1]https://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/provider.xml
[2]https://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/HelloWorld-DOC.wsdl

Freeman

On 2009-8-4, at 下午5:02, Brown, Ben wrote:

> Hi Freeman
>
> Thanks for your response.  I am still a little bit unsure what you  
> mean by using a jbi:part that has both header and body.
>
> Looking at that test, I see the message structure as (ignoring  
> namespaces):
>
> <message>
>   <part>
>      <greetMe>
>         <requestType>header test</requestType>
>      </greetMe>
>   </part>
> </message>
>
> From this I guess that greetMe is the method on the service that you  
> are calling, and you are calling it with the requestType parameter  
> set to be "header test".  However, I don't see where the SoapHeader  
> is set in this, as the message structure actually seems to match the  
> concurrency test (bar the requestType parameter).
>
> I guess that I am missing something here, but I can't quite see  
> what.  For my message the same structure would be:
>
> <message>
>   <part>
>      <SelectAllFundsAsList/>
>   </part>
> </message>
>
> I just don't understand where I need to put that <SecretToken>  
> element?
>
> Apologies if I'm being dumb on this!
>
> Ben
>
>
>
>
>
> -----Original Message-----
> From: Freeman Fang [mailto:[email protected]]
> Sent: 04 August 2009 09:33
> To: [email protected]
> Subject: Re: Adding SoapHeader Information using CXF-BC Provider
>
> Hi,
> You need use jbi message which jbi:part have both header and body,
> also you need remove
> useJBIWrapper="false"
>      useSOAPEnvelope="true"
> from your cxf bc provider xbean configuration.
>
> We have a CxfBcProviderTest[1] which demostrate how it works, you may
> need take a look at it,  the soapHeader() method
>
> [1]https://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
>
> Freeman
> On 2009-8-4, at 下午3:49, Brown, Ben wrote:
>
>> Apologies for trying to bump this (I've tried searching forums,
>> experimenting, but still have no luck), but does anyone have any idea
>> how this can be achieved?
>>
>> The closest I have got to getting this to work is to use the  
>> following
>> xbean.xml:
>>
>> <cxfbc:provider
>>      wsdl="classpath:test.wsdl"
>>     service="b:CorporateOperations"
>>
>> endpoint="BasicHttpBinding_ICorporateOperations_ICorporateOperations"
>>     useJBIWrapper="false"
>>     useSOAPEnvelope="true"/>
>>
>> With the following message structure that I generate through XSLT in
>> Camel:
>>
>> <xsl:template match="/">
>>  <xsl:element name="jbi:message"
>> namespace="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper";>
>>  <xsl:element name="jbi:part"
>> namespace="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper";>
>>  <xsl:element name="soapenv:Envelope"
>> namespace="http://schemas.xmlsoap.org/soap/envelope/";>
>>  <xsl:element name="soapenv:Header"
>> namespace="http://schemas.xmlsoap.org/soap/envelope/";>
>>  <xsl:element name="win:SecretToken"
>> namespace="http://schemas.datacontract.org/2004/07/Test.SoapHeaderFactor
>> y">Removed</xsl:element>
>> </xsl:element>
>>                                      <xsl:element name="soapenv:Body"
>> namespace="http://schemas.xmlsoap.org/soap/envelope/";>
>>                                              <xsl:element
>> name="b:SelectAllFundsAsList"
>> namespace="http://www.test-company.co.uk/
>> B_wcfCorporateOperations.svc"/>
>>                                      </xsl:element>
>>                              </xsl:element>
>>                      </xsl:element>
>>              </xsl:element>
>>      </xsl:template>
>>
>> However looking at the actual data sent over HTTP this actually  
>> sends:
>>
>> <soap:envelope...
>>      <soap:body...
>>        My message here
>>      </soap:body>
>> </soap:envelope>
>>
>> I still don't understand how to remove this envelope and body that  
>> are
>> added automatically - as this seems to be what is prevening me from
>> doing this - unless there is another way to add the headers?
>>
>> Any further information would be greatly appreciated.
>>
>> Thanks
>>
>> Ben Brown
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Brown, Ben [mailto:[email protected]]
>> Sent: 03 August 2009 14:18
>> To: [email protected]
>> Subject: Adding SoapHeader Information using CXF-BC Provider
>>
>> Hi All
>>
>>
>>
>> I've been trying to find an example of this, but haven't got any
>> yet.  I
>> am attempting to add a SoapHeader property to my message, but cannot
>> work out how to do this.  My xbean.xml is as follows:
>>
>>
>>
>> <cxfbc:provider
>>
>>     wsdl="classpath:test.wsdl"
>>
>>       service="b:CorporateOperations"
>>
>>
>> endpoint="BasicHttpBinding_ICorporateOperations_ICorporateOperations"
>>
>>       useJBIWrapper="false"/>
>>
>>
>>
>> I can't understand how to add the SoapHeader as the message seems to
>> have the SoapEnvelope and SoapBody tags added automatically, which
>> means
>> that it's impossible to just specify it as part of my actual message.
>> Reading the comments in the code it appears that I would want to use
>> useJBIWrapper="false" and useSOAPEnvelope="true", but this appears to
>> give a XML parsing error (shown below).
>>
>>
>>
>> I'm creating my message with the following XSLT transform:
>>
>>
>>
>> <xsl:template match="*">
>>
>>           <xsl:element name="soapenv:Envelope"
>> namespace="http://schemas.xmlsoap.org/soap/envelope/";>
>>
>>                 <xsl:element name="soapenv:Header"
>> namespace="http://schemas.xmlsoap.org/soap/envelope/";>
>>
>>                             <xsl:element name="win:SecretToken"
>>
>>
>> namespace="http://schemas.datacontract.org/2004/07/Test.SoapHeaderFactor
>> y"> </xsl:element>
>>
>>                 </xsl:element>
>>
>>                 <xsl:element name="soapenv:Body"
>> namespace="http://schemas.xmlsoap.org/soap/envelope/";>
>>
>>                       <xsl:element name="b:SelectAllFundsAsList"
>> namespace="http://www.test-company.co.uk/
>> B_wcfCorporateOperations.svc"/>
>>
>>                 </xsl:element>
>>
>>           </xsl:element>
>>
>>     </xsl:template>
>>
>>
>>
>> Does anyone have any idea how to add the headers?
>>
>>
>>
>> Thanks
>>
>>
>>
>> Ben
>>
>>
>>
>>
>>
>>
>>
>> 14:13:17,633 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleMessage on interceptor
>> org
>> .apache.servicemix.cxfbc.interceptors.jbioutwsdl1intercep...@17aaccf
>>
>> 14:13:17,649 | INFO  - cxf.phase.PhaseInterceptorChain - Interceptor
>> has
>> thrown exception, unwinding now
>>
>> org.apache.cxf.interceptor.Fault:
>> org.apache.xerces.dom.DeferredTextImpl
>> cannot be cast to org.w3c.dom.Element
>>
>>       at
>> org
>> .apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMe
>> ssage(JbiOutWsdl1Interceptor.java:149)
>>
>>       at
>> org
>> .apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMe
>> ssage(JbiOutWsdl1Interceptor.java:56)
>>
>>       at
>> org
>> .apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
>> hain.java:236)
>>
>>       at
>> org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:
>> 245
>> )
>>
>>       at
>> org
>> .apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeC
>> ycle.java:627)
>>
>>       at
>> org
>> .apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBas
>> eLifeCycle.java:581)
>>
>>       at
>> org
>> .apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncB
>> aseLifeCycle.java:535)
>>
>>       at
>> org
>> .apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(Sync
>> LifeCycleWrapper.java:60)
>>
>>       at
>> org
>> .apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(D
>> eliveryChannelImpl.java:623)
>>
>>       at
>> org
>> .apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.j
>> ava:172)
>>
>>       at
>> org
>> .apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java
>> :168)
>>
>>       at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue
>> $1.run(SedaQueue.java:1
>> 34)
>>
>>       at
>> java.util.concurrent.ThreadPoolExecutor
>> $Worker.runTask(ThreadPoolExecuto
>> r.java:886)
>>
>>       at
>> java.util.concurrent.ThreadPoolExecutor
>> $Worker.run(ThreadPoolExecutor.ja
>> va:908)
>>
>>       at java.lang.Thread.run(Thread.java:619)
>>
>> Caused by: java.lang.ClassCastException:
>> org.apache.xerces.dom.DeferredTextImpl cannot be cast to
>> org.w3c.dom.Element
>>
>>       at
>> org
>> .apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMe
>> ssage(JbiOutWsdl1Interceptor.java:84)
>>
>>       ... 14 more
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org
>> .apache.servicemix.cxfbc.interceptors.jbioutwsdl1intercep...@17aaccf
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org.apache.cxf.binding.soap.interceptor.soapoutintercep...@2f53da
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org.apache.cxf.interceptor.staxoutintercep...@b4600c
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org.apache.servicemix.cxfbc.interceptors.jbioutintercep...@1fb39e3
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org
>> .apache.cxf.binding.soap.interceptor.soapactionoutintercep...@12a1896
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org
>> .apache.cxf.binding.soap.interceptor.soappreprotocoloutintercep...@e7
>> 76e7
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org.apache.cxf.ws.policy.serverpolicyoutfaultintercep...@1f00de9
>>
>> 14:13:17,649 | DEBUG - cxf.phase.PhaseInterceptorChain - Invoking
>> handleFault on interceptor
>> org.apache.cxf.ws.policy.policyoutintercep...@1c7ea6e
>>
>> 14:13:17,665 | DEBUG - jbi.messaging.DeliveryChannelImpl - Send
>> ID:140.140.144.118-122e06341bb-3:0 in DeliveryChannel{servicemix-cxf-
>> bc}
>>
>> 14:13:17,665 | DEBUG - jbi.security.SecuredBroker     - send exchange
>> with secure broker
>>
>> 14:13:17,665 | DEBUG - flow.seda.SedaFlow             - Called Flow
>> send
>>
>> 14:13:17,680 | DEBUG - flow.seda.SedaQueue            -
>> org.apache.servicemix.jbi.nmr.flow.seda.sedaqueu...@3c78ef dequeued
>> exchange: InOut[
>>
>> id: ID:140.140.144.118-122e06341bb-3:0
>>
>> status: Active
>>
>> role: consumer
>>
>> service:
>> {http://www.test-company.co.uk/
>> B_wcfCorporateOperations.svc}CorporateOpe
>> rations
>>
>> endpoint: BasicHttpBinding_ICorporateOperations_ICorporateOperations
>>
>> operation:
>> {http://www.test-company.co.uk/
>> B_wcfCorporateOperations.svc}SelectAllFun
>> dsAsList
>>
>> in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>>
>> <soapenv:Header>
>>
>> <win:SecretToken
>> xmlns:win="http://schemas.datacontract.org/2004/07/Test.SoapHeaderFactor
>> y"> </win:SecretToken>
>>
>> </soapenv:Header>
>>
>> <soapenv:Body>
>>
>> <b:SelectAllFundsAsList
>> xmlns:b="http://www.test-company.co.uk/ 
>> B_wcfCorporateOperations.svc"/>
>>
>> </soapenv:Body>
>>
>> </soapenv:Envelope>
>>
>> fault: <?xml version="1.0" encoding="UTF-8"?><JBIFault
>> xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper";><detail
>> xmlns="">org.apache.xerces.dom.DeferredTextImpl cannot be cast to
>> org.w3c.dom.Element</detail></JBIFault>
>>
>> ]
>>
>>
>>
>> This email and any files or information it contains are confidential
>> and
>> may be privileged.  It is for the intended addressee(s) only.  The
>> unauthorised use, disclosure or copying of this email or any
>> information
>> it contains, is prohibited and could, in certain circumstances be a
>> criminal offence. If you are not the intended recipient you should  
>> not
>> disseminate or copy this email.  Please notify the sender immediately
>> and delete this message from your system.
>>
>> Please note that any opinions presented in this email are solely  
>> those
>> of the author (or those of a third party whose statement is  
>> forwarded)
>> and do not necessarily represent those of any company within the
>> Bluefin
>> Group Limited group of companies.
>>
>> Email transmission cannot be guaranteed to be secure or error free as
>> information could be intercepted, corrupted, lost, destroyed, late in
>> arriving or incomplete as a result of the transmission process.  The
>> sender therefore does not accept liability for any errors or  
>> omissions
>> in the contents of this message which arise as a result of email
>> transmission.
>>
>> WARNING: Computer viruses can be transmitted by email. The recipient
>> should check this email and any attachments for the presence of
>> viruses.
>> The Bluefin Group Limited group of companies accepts no liability for
>> any damage caused by any virus transmitted by this email.
>> --------------------------------------------------------------
>> Protection | Management | Compliance - scanned for viruses and
>> unwanted
>> content by emailsystems
>>
>> Why use a managed email service? Click here to find out
>> This email and any files or information it contains are confidential
>> and may be privileged.  It is for the intended addressee(s) only.
>> The unauthorised use, disclosure or copying of this email or any
>> information it contains, is prohibited and could, in certain
>> circumstances be a criminal offence. If you are not the intended
>> recipient you should not disseminate or copy this email.  Please
>> notify the sender immediately and delete this message from your
>> system.
>>
>> Please note that any opinions presented in this email are solely
>> those of the author (or those of a third party whose statement is
>> forwarded) and do not necessarily represent those of any company
>> within the Bluefin Group Limited group of companies.
>>
>> Email transmission cannot be guaranteed to be secure or error free
>> as information could be intercepted, corrupted, lost, destroyed,
>> late in arriving or incomplete as a result of the transmission
>> process.  The sender therefore does not accept liability for any
>> errors or omissions in the contents of this message which arise as a
>> result of email transmission.
>>
>> WARNING: Computer viruses can be transmitted by email. The recipient
>> should check this email and any attachments for the presence of
>> viruses.  The Bluefin Group Limited group of companies accepts no
>> liability for any damage caused by any virus transmitted by this
>> email.
>
>
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
> --------------------------------------------------------------
> Protection | Management | Compliance - scanned for viruses and  
> unwanted content by emailsystems
>
> Why use a managed email service? Click here to find out
>
> This email and any files or information it contains are confidential  
> and may be privileged.  It is for the intended addressee(s) only.   
> The unauthorised use, disclosure or copying of this email or any  
> information it contains, is prohibited and could, in certain  
> circumstances be a criminal offence. If you are not the intended  
> recipient you should not disseminate or copy this email.  Please  
> notify the sender immediately and delete this message from your  
> system.
>
> Please note that any opinions presented in this email are solely  
> those of the author (or those of a third party whose statement is  
> forwarded) and do not necessarily represent those of any company  
> within the Bluefin Group Limited group of companies.
>
> Email transmission cannot be guaranteed to be secure or error free  
> as information could be intercepted, corrupted, lost, destroyed,  
> late in arriving or incomplete as a result of the transmission  
> process.  The sender therefore does not accept liability for any  
> errors or omissions in the contents of this message which arise as a  
> result of email transmission.
>
> WARNING: Computer viruses can be transmitted by email. The recipient  
> should check this email and any attachments for the presence of  
> viruses.  The Bluefin Group Limited group of companies accepts no  
> liability for any damage caused by any virus transmitted by this  
> email.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


--------------------------------------------------------------
Protection | Management | Compliance - scanned for viruses and unwanted content 
by emailsystems

Why use a managed email service? Click here to find out

This email and any files or information it contains are confidential and may be 
privileged.  It is for the intended addressee(s) only.  The unauthorised use, 
disclosure or copying of this email or any information it contains, is 
prohibited and could, in certain circumstances be a criminal offence. If you 
are not the intended recipient you should not disseminate or copy this email.  
Please notify the sender immediately and delete this message from your system. 

Please note that any opinions presented in this email are solely those of the 
author (or those of a third party whose statement is forwarded) and do not 
necessarily represent those of any company within the Bluefin Group Limited 
group of companies.

Email transmission cannot be guaranteed to be secure or error free as 
information could be intercepted, corrupted, lost, destroyed, late in arriving 
or incomplete as a result of the transmission process.  The sender therefore 
does not accept liability for any errors or omissions in the contents of this 
message which arise as a result of email transmission.

WARNING: Computer viruses can be transmitted by email. The recipient should 
check this email and any attachments for the presence of viruses.  The Bluefin 
Group Limited group of companies accepts no liability for any damage caused by 
any virus transmitted by this email.

Reply via email to