Yes, this is in fact what I had been doing... but when you define the
header as a separate message, CXF doesn't pass the header object in as a
parameter.  So then, I'm not sure how to get access to it...

Also, Gary Tully pointed out some recommendations in the WS-I Basic
Profile that seem to suggest that the header should be a part in the
same message as the body.  But the wording is slightly ambiguous.

I've started rewriting my implementation in the BARE style and I'm
actually finding that I also might prefer it.  My only hesitation is
that it is my understanding that doc/literal wrapped is best for
interoperability (but I can't recall where I picked that up).

-Chris

-----Original Message-----
From: Matthew Good [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 05, 2007 1:20 PM
To: cxf-user@incubator.apache.org
Subject: RE: How To Get Object From SOAP Header?

Not sure if this will help, but you can define the
header as a separate message so that you message
definitions still only have one part.  (Don't take
everything in this example literally as I like bare
;).


<message name="Identifier">
    <part name="Identifier" element="wse:Identifier"
/>
  </message>
  <message name="GetStatusMsg">
    <part name="body" element="wse:GetStatus" />
  </message>
...
  <portType name="Manager">
    <operation name="GetStatus">
      <input message="tns:GetStatusMsg" />
      <output message="tns:GetStatusResponseMsg" />
    </operation>
...
  <binding name="SubManagerBinding"
type="tns:SubscriptionManager">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http";></soap:binding>
    <operation name="GetStatus">
      <soap:operation
soapAction="http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus";></
soap:operation>
      <input>
        <soap:header message="tns:Identifier"
part="Identifier" use="literal"/>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
...


--- Christopher Moesel <[EMAIL PROTECTED]>
wrote:

> So... if the header must be defined as a part in the
> message, then it is
> impossible to use SOAP headers in a CXF doc/literal
> wrapped service?
> 
> Section 2.3.1.2 of the JAX-WS spec states that an
> operation is only
> considered to be wrapper style if the input and
> output messages each
> only have a *single* part.
> 
> It appears that CXF honors the spec:  after changing
> my WSDL to specify
> the header as a part in each message, CXF now
> generates the service
> interface in the BARE style.
> 
> Ugh.  What to do?
> 
> -Chris
> 
> -----Original Message-----
> From: Tully, Gary [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, April 04, 2007 6:13 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
> 
> Hi Chris,
> 
> From my reading of the basic profile I think the
> only the sample wsdl is
> correct.  
> Check out these relevant bits[1][2] for some more
> detail. 
> 
> Hope this helps,
> Gary.
> 
> [1]
>
http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#R2208
> [2]
>
http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#R2738
> 
> > -----Original Message-----
> > From: Christopher Moesel
> [mailto:[EMAIL PROTECTED] 
> > Sent: 04 April 2007 22:54
> > To: cxf-user@incubator.apache.org
> > Subject: RE: How To Get Object From SOAP Header?
> > 
> > Ugh.  I apologize for the weird way my email
> client formatted 
> > those xml fragments.  I've tried to fix them
> below-- let's 
> > see if it works!
> > 
> > -----Original Message-----
> > From: Christopher Moesel
> [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 04, 2007 5:51 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: How To Get Object From SOAP Header?
> > 
> > Actually, after looking at some of the CXF
> samples, I see 
> > that CXF is expecting the WSDL to be a bit
> different than how 
> > I have done it.
> > 
> > CXF expects the header to be defined as a part in
> the request 
> > message, as well as to be specified in the
> wsdl:binding. For example:
> > 
> > <wsdl:message name="MyOperationRequest">
> >   <wsdl:part name="credentials"
> element="types:UserCredentials"/>
> >   <wsdl:part name="body"
> element="types:MyOperation"/> </wsdl:message>
> > 
> > ...
> > 
> > <wsdl:operation name="MyOperation">
> >   <soap:operation soapAction=""/>
> >   <wsdl:input>
> >     <soap:header message="tns:MyOperationRequest"
> part="credentials"
> > use="literal" />
> >     <soap:body parts="body" use="literal"/>
> >   </wsdl:input>
> > 
> >   ...
> > 
> > </wsdl:operation>
> > 
> > My current WSDL defines a separate message type
> for the 
> > header rather than adding it as a part in the
> request 
> > message.  It references this header in the
> wsdl:binding.  
> > This worked in XFire:
> > 
> > <wsdl:message name="UserCredentials">
> >   <wsdl:part name="credentials" 
> > element="types:UserCredentials"/> </wsdl:message> 
> > <wsdl:message name="MyOperationRequest">
> >   <wsdl:part name="body"
> element="types:MyOperation"/> </wsdl:message>
> > 
> > ...
> > 
> > <wsdl:operation name="MyOperation">
> >   <soap:operation soapAction=""/>
> >   <wsdl:input>
> >     <soap:header message="tns:UserCredentials"
> part="credentials"
> > use="literal" />
> >     <soap:body use="literal"/>
> >   </wsdl:input>
> > 
> >   ...
> > 
> > </wsdl:operation>
> > 
> > Is my WSDL in bad form?  Or is this something CXF
> should be 
> > able to handle?  I prefer my current method as it
> is a little 
> > less verbose when re-using the header over several
> operations.
> >     
> > Thanks,
> > Chris
> > 
> > -----Original Message-----
> > From: Christopher Moesel
> [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 04, 2007 5:32 PM
> > To: cxf-user@incubator.apache.org
> > Subject: How To Get Object From SOAP Header?
> > 
> > I have a custom authentication type that clients
> send me 
> > through the SOAP header.  In XFire, it generated
> the service 
> > interface with the header message sent in as a
> parameter.  
> > CXF does not do that.
> > 
> > How can I get access to that data from within my
> service 
> > implementation?
> > 
> > Thanks,
> > Chris
> > 
> 


Matthew Good
[EMAIL PROTECTED]
720-320-8376

Reply via email to