Hi,
my java method looks like this:
public CreateOrderEventResponse createOrder(BaseOrder baseOrder) throws
CreateOrderFaultResponse;
It takes a BaseOrder as input, which is defined in XSD and imported in WSDL:
...
<portType name="orderServicePort">
<operation name="createOrder">
<input message="tns:createOrderRequest"/>
<output message="tns:createOrderResponse"/>
<fault name="OrderServiceFault"
message="tns:createOrderFaultResponse"/>
</operation>
</portType>
...
The SOAP Header (systemRequest) contains the email address of the user who
has initiated the communication. I thought as it is not neccessary for the
communication, I did not put it in the payload, but in the header.
Now, lets say we get an Exception in my createOrder method, I would like to
get the email address from the soap header and send the user a mail.
Means normally I should not need the user's mail from the systemRequest
element, only in case of Errors.
So again, lets say I have an exception in my createorder() method.
I think I need what you mentioned below:
List<SoapHeaderInfo> headers =
wsdlMessage.getExtensors(SoapHeaderInfo.class);
Where do I get the WSDLMessage from. Currently I don't have it in my
createOrder() method.
Thanks & regards!
Freeman Fang wrote:
>
> Hi,
>
> Your createorder method has input parameter, right?
> It should be defined as message="tns:systemRequest" part="parameters"
>
>
> In fact, this parameter will be mashelled as soap header in soap message
> according to
> your soap binding part defined in your wsdl.
>
> So, the input parameter is soap header you want.
>
> Btw, [1] & [2] is preview for the cxf component docs
> [1]http://servicemix.apache.org/servicemix-cxf-se.html
> [2]http://servicemix.apache.org/servicemix-cxf-bc.html
> Best Regards
>
> Freeman
>
> On 12/14/07, Cybexion <[EMAIL PROTECTED]> wrote:
>>
>>
>> OK,
>> my example is build completely on cxf_wsdl_first.
>> Just a different WSDL and a different java implementation (se).
>> I have a bc, se, and sa (like cxf_wsdl_first).
>> bc just contains the wsdl.
>> Code ist generated by maven/wsdl2java from wsdl.
>> My java code does not see any soap header stuff, just the
>> createorder(...)
>> method.
>> Yes, I wanted to access the header from my se.
>> However, I don't know about the interceptor (where to put it, how to
>> use).
>> I'll try to find out more about it (docs) ...
>>
>> Thanks!!!
>>
>>
>>
>> Freeman Fang-2 wrote:
>> >
>> > I am not sure I understand your scenario correctly
>> > Would you please describe your use case more detail?
>> > Did you use cxf bc or se inside servicemix? Did you generate your code
>> > stub using cxf codegen from the wsdl? Did you want to access soap
>> header
>> > inside servicemix cxf se ?
>> > Cxf will do soap header / method para mapping for you according to
>> the
>> > service model so generallly you shouldn't care about the soap header
>> > issue yourself.
>> >
>> > If you want to access soap headder in your incerceptors, you can do as
>> > follows
>> > List<SoapHeaderInfo> headers =
>> > wsdlMessage.getExtensors(SoapHeaderInfo.class);
>> > List<Header> headerElement = message.getHeaders();
>> > You can get more details from JbiInWsdl1Interceptor.java of
>> > servicemix-cxf-bc component
>> >
>> > Best Regards
>> >
>> > Freeman
>> >
>> >
>> > Cybexion wrote:
>> >> Hi,
>> >>
>> >> I've specified a WSDL for an OrderService. Inside my Binding I have
>> >> defined
>> >> that a SOAP Header should be send.
>> >>
>> >> <<<WSDL
>> >> ...
>> >> <binding name="OrderServiceBinding" type="tns:orderServicePort">
>> >> <soap:binding style="document"
>> >> transport="http://schemas.xmlsoap.org/soap/http"/>
>> >> <operation name="createOrder">
>> >> <soap:operation
>> >> soapAction="http://localhost/adf/OrderService"/>
>> >> <input>
>> >> <soap:header message="tns:systemRequest"
>> >> part="parameters"
>> >> use="literal"/>
>> >> <soap:body use="literal"/>
>> >> </input>
>> >> <output>
>> >> <soap:body use="literal"/>
>> >> </output>
>> >> </operation>
>> >> </binding>
>> >> WSDL >>>
>> >>
>> >>
>> >>
>> >> <<<SOAP
>> >> ...
>> >> <Header>
>> >> <adf:system id="1" version="1">
>> >> <adf:loginuseremail>[EMAIL PROTECTED]</adf:loginuseremail>
>> >> </adf:system>
>> >> </Header>
>> >> ...
>> >> SOAP>>>
>> >>
>> >> The request and response works fine. Also the Javacode for the payload
>> is
>> >> executed.
>> >> Now some questions:
>> >> 1) How and where can I access the data from the SOAP Header?
>> >> 2) If I remove the Header Stuff from my SOAP Request, everything stil
>> >> works
>> >> fine.
>> >> (Do I need must understand = true to make it required)
>> >>
>> >> Thanks!
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/CXF-access-SOAP-Header-tp14314133s12049p14333665.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/CXF-access-SOAP-Header-tp14314133s12049p14370205.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.