You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Moesel <Ch...@avid.com> on 2007/04/04 23:31:33 UTC

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

RE: How To Get Object From SOAP Header?

Posted by "Tully, Gary" <Ga...@iona.com>.
Hi Chris,
The soap_header sample[1] covers what you want I think. The header as an
operation parameter.
Hope this helps,
Gary. 

[1]
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/r
elease/samples/soap_header/README.txt?view=markup

> -----Original Message-----
> From: Christopher Moesel [mailto:Christopher_Moesel@avid.com] 
> Sent: 04 April 2007 22:32
> 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
> 

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
I have created a very simple example project that demonstrates the
wsdl2java bug (where it excludes the headers from the message
signature).  It is attached to the bug that Dan D created:
https://issues.apache.org/jira/browse/CXF-602

-Chris

-----Original Message-----
From: Dan Diephouse [mailto:dan@envoisolutions.com] 
Sent: Wednesday, April 25, 2007 2:54 PM
To: cxf-user@incubator.apache.org; dkulp@apache.org
Subject: Re: How To Get Object From SOAP Header?

I created a JIRA for this -
https://issues.apache.org/jira/browse/CXF-602.
Sounds like we should focus on getting these things fixed for 2.0.

- Dan

On 4/25/07, Daniel Kulp <dk...@apache.org> wrote:
>
>
> OK.  It definitely doesn't work on the Ebay wsdl.   :-(
>
> Dan
>
>
> On Wednesday 25 April 2007 07:37, Daniel Kulp wrote:
> > Chris,
> >
> > I believe CXF already does this.   If the wsdl has a physical
contract
> > that has headers in a separate message, wsdl2java does put an extra
> > parameter on the method with header="true" set.    I tried this on a
> > simple wsdl and it seems to generate the expected code.  (don't
> > actually have a service to check it against right now)   Is there
any
> > chance you could try it on a couple of "real world" wsdls?
> >
> > I don't think round tripping would work though.  wsdl2java, then
> > java2wsdl would probably put the header into a single message.
> >
> > Dan
> >
> > On Tuesday 24 April 2007 09:03, Christopher Moesel wrote:
> > > Yes, this would require the code generator to look at the physical
> > > portion of the WSDL.  I realize it's not ideal, but... again, if
> > > it's happening in the real world, it needs to be considered.  Has
> > > CXF been tested as a client against eBay and Salesforce.com?
> > >
> > > -Chris
> > >
> > > -----Original Message-----
> > > From: Johnson, Eric [mailto:Eric.Johnson@iona.com]
> > > Sent: Monday, April 23, 2007 5:17 PM
> > > To: cxf-user@incubator.apache.org
> > > Subject: RE: How To Get Object From SOAP Header?
> > >
> > > To do what you ask the code generators would need to generate code
> > > based on the contents of the physical portion of the WSDL (aka the
> > > wsdl:binding element) correct?
> > >
> > > > -----Original Message-----
> > > > From: Christopher Moesel [mailto:Christopher_Moesel@avid.com]
> > > > Sent: Monday, April 23, 2007 5:11 PM
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: RE: How To Get Object From SOAP Header?
> > > >
> > > > Dan-- I think you may be talking about a slightly different
issue?
> > > >
> > > > I don't want to disable headers inside wsdl2java.  What I
> > > > want is for wsdl2java to generate the header parameters in
> > > > the interface even if the header object is not a part of the
> > > > operation input (or output) message.
> > > >
> > > > For example, I want the following WSDL to cause the
> > > > UserCredentialsType object to be passed in through the
> > > > generated interface:
> > > >
> > > > <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> <!-- imagine other messages here... -->
> > > >
> > > > <wsdl:operation name="MyOperation">
> > > >   <soap:operation soapAction=""/>
> > > >   <wsdl:input>
> > > >     <soap:header message="tns:UserCredentials"
part="credentials"
> > > > use="literal" />
> > > >     <soap:body use="literal"/>
> > > >   </wsdl:input>
> > > >   <!-- imagine a wsdl:output and wsdl:fault here... -->
> > > > </wsdl:operation>
> > > >
> > > > The current CXF wsdl2java will not create a parameter for the
> > > > UserCredentialsType object, because it is not a wsdl:part of
> > > > the MyOperationRequest message.  This current behavior
> > > > appears to be based on recommendation by WS-I (but not a
> > > > mandatory rule by WS-I).
> > > >
> > > > XFire does indeed generate the header object parameter as
> > > > expected in this case.  I think XFire does the right thing,
> > > > based on what I see out there in the real world.  I'd like
> > > > CXF to also do this.
> > > >
> > > > -Chris
> > > >
> > > > -----Original Message-----
> > > > From: Dan Diephouse [mailto:dan@envoisolutions.com]
> > > > Sent: Monday, April 23, 2007 4:57 PM
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: Re: How To Get Object From SOAP Header?
> > > >
> > > > I did one project where we did this via an Interceptor and a
> > > > wsdl post processor. We wrote the WSDL without the header,
> > > > generated the code, then at runtime we modified the WSDL
> > > > document to add in the header. Our Interceptor was then
> > > > responsible for parsing the header and authentication.
> > > >
> > > > I would like to find a better way to do this though. Maybe a
> > > > flag to disable headers inside wsdl2java?
> > > >
> > > > Cheers,
> > > > - Dan
> > > >
> > > > On 4/23/07, Christopher Moesel <Ch...@avid.com>
wrote:
> > > > > To bring up a point from a couple of weeks ago:
> > > > >
> > > > > I agree with Matthew-- CXF should support SOAP headers that
are
> > > >
> > > > defined
> > > >
> > > > > in their own message (rather than having to make the header
> > > >
> > > > a part in
> > > >
> > > > > the operation's request message).  This is much more concise
and
> > > > > is often seen in the real world.  This is the way that the
> > > >
> > > > salesforce.com
> > > >
> > > > > enterprise WSDL is defined, as well as the eBay WSDL.
> > > > >
> > > > > Is this something that CXF could easily support?
> > > > >
> > > > > -Chris
> > > > >
> > > > > -----Original Message-----
> > > > > From: Matthew Good [mailto:matt_good@yahoo.com]
> > > > > Sent: Thursday, April 05, 2007 3:11 PM
> > > > > To: cxf-user@incubator.apache.org
> > > > > Subject: RE: How To Get Object From SOAP Header?
> > > > >
> > > > > WS-I 2208 is a "MAY" clause.  So using separate messages is
WS-I
> > > > > compliant.  (You scared me for a second).
> > > > >
> > > > > The wrapped vs. bare is not explicitly set in the wsdl.  Sure
it
> > > > > is somewhat specified based on those rules in jax-ws but a
> > > > > source generation tool should have an option to override that
as
> > > >
> > > > best it can.
> > > >
> > > > > As far as interoperability, WS-I is the only thing that we
> > > >
> > > > should have
> > > >
> > > > > to abide by (jax-ws - Java!).  In .NET there is a switch
> > > >
> > > > for wrapped
> > > >
> > > > > vs. bare and I have found nothing that matters from an
> > > > > interoperability standpoint which way the switch is set.  The
> > > > > resulting SOAP message is the same.
> > > > >
> > > > > So, doc/literal yes, use it.  My opinion is that jax-ws trying
> > > > > to determine wrapped vs. bare based on a bunch of rules is
> > > >
> > > > absurd.  It's
> > > >
> > > > > really a developer preference.  (I am talking wsdl first
> > > >
> > > > development
> > > >
> > > > > here).
> > > > >
> > > > >
> > > > > --- Christopher Moesel <Ch...@avid.com>
> > > > >
> > > > > wrote:
> > > > > > 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:matt_good@yahoo.com]
> > > > > > 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/Get
> > > > Status"></
> > > >
> > > > > > 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 <Ch...@avid.com>
> > > > > >
> > > > > > 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:Gary.Tully@iona.com]
> > > > > > > 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#R2
> > > > >20 8
> > > > >
> > > > > > > [2]
> > > > >
> > > > >
http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#R2
> > > > >73 8
> > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Christopher Moesel
> > > > > > >
> > > > > > > [mailto:Christopher_Moesel@avid.com]
> > > > > > >
> > > > > > > > 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:Christopher_Moesel@avid.com]
> > > > > > >
> > > > > > > > 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:Christopher_Moesel@avid.com]
> > > > > > >
> > > > > > > > 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
> > > > > > matthew.good@yahoo.com
> > > > > > 720-320-8376
> > > > >
> > > > > Matthew Good
> > > > > matthew.good@yahoo.com
> > > > > 720-320-8376
> > > >
> > > > --
> > > > Dan Diephouse
> > > > Envoi Solutions
> > > > http://envoisolutions.com | http://netzooid.com/blog
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: How To Get Object From SOAP Header?

Posted by Dan Diephouse <da...@envoisolutions.com>.
I created a JIRA for this - https://issues.apache.org/jira/browse/CXF-602.
Sounds like we should focus on getting these things fixed for 2.0.

- Dan

On 4/25/07, Daniel Kulp <dk...@apache.org> wrote:
>
>
> OK.  It definitely doesn't work on the Ebay wsdl.   :-(
>
> Dan
>
>
> On Wednesday 25 April 2007 07:37, Daniel Kulp wrote:
> > Chris,
> >
> > I believe CXF already does this.   If the wsdl has a physical contract
> > that has headers in a separate message, wsdl2java does put an extra
> > parameter on the method with header="true" set.    I tried this on a
> > simple wsdl and it seems to generate the expected code.  (don't
> > actually have a service to check it against right now)   Is there any
> > chance you could try it on a couple of "real world" wsdls?
> >
> > I don't think round tripping would work though.  wsdl2java, then
> > java2wsdl would probably put the header into a single message.
> >
> > Dan
> >
> > On Tuesday 24 April 2007 09:03, Christopher Moesel wrote:
> > > Yes, this would require the code generator to look at the physical
> > > portion of the WSDL.  I realize it's not ideal, but... again, if
> > > it's happening in the real world, it needs to be considered.  Has
> > > CXF been tested as a client against eBay and Salesforce.com?
> > >
> > > -Chris
> > >
> > > -----Original Message-----
> > > From: Johnson, Eric [mailto:Eric.Johnson@iona.com]
> > > Sent: Monday, April 23, 2007 5:17 PM
> > > To: cxf-user@incubator.apache.org
> > > Subject: RE: How To Get Object From SOAP Header?
> > >
> > > To do what you ask the code generators would need to generate code
> > > based on the contents of the physical portion of the WSDL (aka the
> > > wsdl:binding element) correct?
> > >
> > > > -----Original Message-----
> > > > From: Christopher Moesel [mailto:Christopher_Moesel@avid.com]
> > > > Sent: Monday, April 23, 2007 5:11 PM
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: RE: How To Get Object From SOAP Header?
> > > >
> > > > Dan-- I think you may be talking about a slightly different issue?
> > > >
> > > > I don't want to disable headers inside wsdl2java.  What I
> > > > want is for wsdl2java to generate the header parameters in
> > > > the interface even if the header object is not a part of the
> > > > operation input (or output) message.
> > > >
> > > > For example, I want the following WSDL to cause the
> > > > UserCredentialsType object to be passed in through the
> > > > generated interface:
> > > >
> > > > <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> <!-- imagine other messages here... -->
> > > >
> > > > <wsdl:operation name="MyOperation">
> > > >   <soap:operation soapAction=""/>
> > > >   <wsdl:input>
> > > >     <soap:header message="tns:UserCredentials" part="credentials"
> > > > use="literal" />
> > > >     <soap:body use="literal"/>
> > > >   </wsdl:input>
> > > >   <!-- imagine a wsdl:output and wsdl:fault here... -->
> > > > </wsdl:operation>
> > > >
> > > > The current CXF wsdl2java will not create a parameter for the
> > > > UserCredentialsType object, because it is not a wsdl:part of
> > > > the MyOperationRequest message.  This current behavior
> > > > appears to be based on recommendation by WS-I (but not a
> > > > mandatory rule by WS-I).
> > > >
> > > > XFire does indeed generate the header object parameter as
> > > > expected in this case.  I think XFire does the right thing,
> > > > based on what I see out there in the real world.  I'd like
> > > > CXF to also do this.
> > > >
> > > > -Chris
> > > >
> > > > -----Original Message-----
> > > > From: Dan Diephouse [mailto:dan@envoisolutions.com]
> > > > Sent: Monday, April 23, 2007 4:57 PM
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: Re: How To Get Object From SOAP Header?
> > > >
> > > > I did one project where we did this via an Interceptor and a
> > > > wsdl post processor. We wrote the WSDL without the header,
> > > > generated the code, then at runtime we modified the WSDL
> > > > document to add in the header. Our Interceptor was then
> > > > responsible for parsing the header and authentication.
> > > >
> > > > I would like to find a better way to do this though. Maybe a
> > > > flag to disable headers inside wsdl2java?
> > > >
> > > > Cheers,
> > > > - Dan
> > > >
> > > > On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
> > > > > To bring up a point from a couple of weeks ago:
> > > > >
> > > > > I agree with Matthew-- CXF should support SOAP headers that are
> > > >
> > > > defined
> > > >
> > > > > in their own message (rather than having to make the header
> > > >
> > > > a part in
> > > >
> > > > > the operation's request message).  This is much more concise and
> > > > > is often seen in the real world.  This is the way that the
> > > >
> > > > salesforce.com
> > > >
> > > > > enterprise WSDL is defined, as well as the eBay WSDL.
> > > > >
> > > > > Is this something that CXF could easily support?
> > > > >
> > > > > -Chris
> > > > >
> > > > > -----Original Message-----
> > > > > From: Matthew Good [mailto:matt_good@yahoo.com]
> > > > > Sent: Thursday, April 05, 2007 3:11 PM
> > > > > To: cxf-user@incubator.apache.org
> > > > > Subject: RE: How To Get Object From SOAP Header?
> > > > >
> > > > > WS-I 2208 is a "MAY" clause.  So using separate messages is WS-I
> > > > > compliant.  (You scared me for a second).
> > > > >
> > > > > The wrapped vs. bare is not explicitly set in the wsdl.  Sure it
> > > > > is somewhat specified based on those rules in jax-ws but a
> > > > > source generation tool should have an option to override that as
> > > >
> > > > best it can.
> > > >
> > > > > As far as interoperability, WS-I is the only thing that we
> > > >
> > > > should have
> > > >
> > > > > to abide by (jax-ws - Java!).  In .NET there is a switch
> > > >
> > > > for wrapped
> > > >
> > > > > vs. bare and I have found nothing that matters from an
> > > > > interoperability standpoint which way the switch is set.  The
> > > > > resulting SOAP message is the same.
> > > > >
> > > > > So, doc/literal yes, use it.  My opinion is that jax-ws trying
> > > > > to determine wrapped vs. bare based on a bunch of rules is
> > > >
> > > > absurd.  It's
> > > >
> > > > > really a developer preference.  (I am talking wsdl first
> > > >
> > > > development
> > > >
> > > > > here).
> > > > >
> > > > >
> > > > > --- Christopher Moesel <Ch...@avid.com>
> > > > >
> > > > > wrote:
> > > > > > 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:matt_good@yahoo.com]
> > > > > > 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/Get
> > > > Status"></
> > > >
> > > > > > 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 <Ch...@avid.com>
> > > > > >
> > > > > > 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:Gary.Tully@iona.com]
> > > > > > > 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#R2
> > > > >20 8
> > > > >
> > > > > > > [2]
> > > > >
> > > > > http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#R2
> > > > >73 8
> > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Christopher Moesel
> > > > > > >
> > > > > > > [mailto:Christopher_Moesel@avid.com]
> > > > > > >
> > > > > > > > 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:Christopher_Moesel@avid.com]
> > > > > > >
> > > > > > > > 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:Christopher_Moesel@avid.com]
> > > > > > >
> > > > > > > > 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
> > > > > > matthew.good@yahoo.com
> > > > > > 720-320-8376
> > > > >
> > > > > Matthew Good
> > > > > matthew.good@yahoo.com
> > > > > 720-320-8376
> > > >
> > > > --
> > > > Dan Diephouse
> > > > Envoi Solutions
> > > > http://envoisolutions.com | http://netzooid.com/blog
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: How To Get Object From SOAP Header?

Posted by Daniel Kulp <dk...@apache.org>.
OK.  It definitely doesn't work on the Ebay wsdl.   :-(

Dan


On Wednesday 25 April 2007 07:37, Daniel Kulp wrote:
> Chris,
>
> I believe CXF already does this.   If the wsdl has a physical contract
> that has headers in a separate message, wsdl2java does put an extra
> parameter on the method with header="true" set.    I tried this on a
> simple wsdl and it seems to generate the expected code.  (don't
> actually have a service to check it against right now)   Is there any
> chance you could try it on a couple of "real world" wsdls?
>
> I don't think round tripping would work though.  wsdl2java, then
> java2wsdl would probably put the header into a single message.
>
> Dan
>
> On Tuesday 24 April 2007 09:03, Christopher Moesel wrote:
> > Yes, this would require the code generator to look at the physical
> > portion of the WSDL.  I realize it's not ideal, but... again, if
> > it's happening in the real world, it needs to be considered.  Has
> > CXF been tested as a client against eBay and Salesforce.com?
> >
> > -Chris
> >
> > -----Original Message-----
> > From: Johnson, Eric [mailto:Eric.Johnson@iona.com]
> > Sent: Monday, April 23, 2007 5:17 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: How To Get Object From SOAP Header?
> >
> > To do what you ask the code generators would need to generate code
> > based on the contents of the physical portion of the WSDL (aka the
> > wsdl:binding element) correct?
> >
> > > -----Original Message-----
> > > From: Christopher Moesel [mailto:Christopher_Moesel@avid.com]
> > > Sent: Monday, April 23, 2007 5:11 PM
> > > To: cxf-user@incubator.apache.org
> > > Subject: RE: How To Get Object From SOAP Header?
> > >
> > > Dan-- I think you may be talking about a slightly different issue?
> > >
> > > I don't want to disable headers inside wsdl2java.  What I
> > > want is for wsdl2java to generate the header parameters in
> > > the interface even if the header object is not a part of the
> > > operation input (or output) message.
> > >
> > > For example, I want the following WSDL to cause the
> > > UserCredentialsType object to be passed in through the
> > > generated interface:
> > >
> > > <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> <!-- imagine other messages here... -->
> > >
> > > <wsdl:operation name="MyOperation">
> > >   <soap:operation soapAction=""/>
> > >   <wsdl:input>
> > >     <soap:header message="tns:UserCredentials" part="credentials"
> > > use="literal" />
> > >     <soap:body use="literal"/>
> > >   </wsdl:input>
> > >   <!-- imagine a wsdl:output and wsdl:fault here... -->
> > > </wsdl:operation>
> > >
> > > The current CXF wsdl2java will not create a parameter for the
> > > UserCredentialsType object, because it is not a wsdl:part of
> > > the MyOperationRequest message.  This current behavior
> > > appears to be based on recommendation by WS-I (but not a
> > > mandatory rule by WS-I).
> > >
> > > XFire does indeed generate the header object parameter as
> > > expected in this case.  I think XFire does the right thing,
> > > based on what I see out there in the real world.  I'd like
> > > CXF to also do this.
> > >
> > > -Chris
> > >
> > > -----Original Message-----
> > > From: Dan Diephouse [mailto:dan@envoisolutions.com]
> > > Sent: Monday, April 23, 2007 4:57 PM
> > > To: cxf-user@incubator.apache.org
> > > Subject: Re: How To Get Object From SOAP Header?
> > >
> > > I did one project where we did this via an Interceptor and a
> > > wsdl post processor. We wrote the WSDL without the header,
> > > generated the code, then at runtime we modified the WSDL
> > > document to add in the header. Our Interceptor was then
> > > responsible for parsing the header and authentication.
> > >
> > > I would like to find a better way to do this though. Maybe a
> > > flag to disable headers inside wsdl2java?
> > >
> > > Cheers,
> > > - Dan
> > >
> > > On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
> > > > To bring up a point from a couple of weeks ago:
> > > >
> > > > I agree with Matthew-- CXF should support SOAP headers that are
> > >
> > > defined
> > >
> > > > in their own message (rather than having to make the header
> > >
> > > a part in
> > >
> > > > the operation's request message).  This is much more concise and
> > > > is often seen in the real world.  This is the way that the
> > >
> > > salesforce.com
> > >
> > > > enterprise WSDL is defined, as well as the eBay WSDL.
> > > >
> > > > Is this something that CXF could easily support?
> > > >
> > > > -Chris
> > > >
> > > > -----Original Message-----
> > > > From: Matthew Good [mailto:matt_good@yahoo.com]
> > > > Sent: Thursday, April 05, 2007 3:11 PM
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: RE: How To Get Object From SOAP Header?
> > > >
> > > > WS-I 2208 is a "MAY" clause.  So using separate messages is WS-I
> > > > compliant.  (You scared me for a second).
> > > >
> > > > The wrapped vs. bare is not explicitly set in the wsdl.  Sure it
> > > > is somewhat specified based on those rules in jax-ws but a
> > > > source generation tool should have an option to override that as
> > >
> > > best it can.
> > >
> > > > As far as interoperability, WS-I is the only thing that we
> > >
> > > should have
> > >
> > > > to abide by (jax-ws - Java!).  In .NET there is a switch
> > >
> > > for wrapped
> > >
> > > > vs. bare and I have found nothing that matters from an
> > > > interoperability standpoint which way the switch is set.  The
> > > > resulting SOAP message is the same.
> > > >
> > > > So, doc/literal yes, use it.  My opinion is that jax-ws trying
> > > > to determine wrapped vs. bare based on a bunch of rules is
> > >
> > > absurd.  It's
> > >
> > > > really a developer preference.  (I am talking wsdl first
> > >
> > > development
> > >
> > > > here).
> > > >
> > > >
> > > > --- Christopher Moesel <Ch...@avid.com>
> > > >
> > > > wrote:
> > > > > 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:matt_good@yahoo.com]
> > > > > 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/Get
> > > Status"></
> > >
> > > > > 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 <Ch...@avid.com>
> > > > >
> > > > > 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:Gary.Tully@iona.com]
> > > > > > 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#R2
> > > >20 8
> > > >
> > > > > > [2]
> > > >
> > > > http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#R2
> > > >73 8
> > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Christopher Moesel
> > > > > >
> > > > > > [mailto:Christopher_Moesel@avid.com]
> > > > > >
> > > > > > > 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:Christopher_Moesel@avid.com]
> > > > > >
> > > > > > > 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:Christopher_Moesel@avid.com]
> > > > > >
> > > > > > > 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
> > > > > matthew.good@yahoo.com
> > > > > 720-320-8376
> > > >
> > > > Matthew Good
> > > > matthew.good@yahoo.com
> > > > 720-320-8376
> > >
> > > --
> > > Dan Diephouse
> > > Envoi Solutions
> > > http://envoisolutions.com | http://netzooid.com/blog

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: How To Get Object From SOAP Header?

Posted by Daniel Kulp <dk...@apache.org>.
Chris,

I believe CXF already does this.   If the wsdl has a physical contract 
that has headers in a separate message, wsdl2java does put an extra 
parameter on the method with header="true" set.    I tried this on a 
simple wsdl and it seems to generate the expected code.  (don't actually 
have a service to check it against right now)   Is there any chance you 
could try it on a couple of "real world" wsdls?

I don't think round tripping would work though.  wsdl2java, then 
java2wsdl would probably put the header into a single message.

Dan

On Tuesday 24 April 2007 09:03, Christopher Moesel wrote:
> Yes, this would require the code generator to look at the physical
> portion of the WSDL.  I realize it's not ideal, but... again, if it's
> happening in the real world, it needs to be considered.  Has CXF been
> tested as a client against eBay and Salesforce.com?
>
> -Chris
>
> -----Original Message-----
> From: Johnson, Eric [mailto:Eric.Johnson@iona.com]
> Sent: Monday, April 23, 2007 5:17 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
>
> To do what you ask the code generators would need to generate code
> based on the contents of the physical portion of the WSDL (aka the
> wsdl:binding element) correct?
>
> > -----Original Message-----
> > From: Christopher Moesel [mailto:Christopher_Moesel@avid.com]
> > Sent: Monday, April 23, 2007 5:11 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: How To Get Object From SOAP Header?
> >
> > Dan-- I think you may be talking about a slightly different issue?
> >
> > I don't want to disable headers inside wsdl2java.  What I
> > want is for wsdl2java to generate the header parameters in
> > the interface even if the header object is not a part of the
> > operation input (or output) message.
> >
> > For example, I want the following WSDL to cause the
> > UserCredentialsType object to be passed in through the
> > generated interface:
> >
> > <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> <!-- imagine other messages here... -->
> >
> > <wsdl:operation name="MyOperation">
> >   <soap:operation soapAction=""/>
> >   <wsdl:input>
> >     <soap:header message="tns:UserCredentials" part="credentials"
> > use="literal" />
> >     <soap:body use="literal"/>
> >   </wsdl:input>
> >   <!-- imagine a wsdl:output and wsdl:fault here... -->
> > </wsdl:operation>
> >
> > The current CXF wsdl2java will not create a parameter for the
> > UserCredentialsType object, because it is not a wsdl:part of
> > the MyOperationRequest message.  This current behavior
> > appears to be based on recommendation by WS-I (but not a
> > mandatory rule by WS-I).
> >
> > XFire does indeed generate the header object parameter as
> > expected in this case.  I think XFire does the right thing,
> > based on what I see out there in the real world.  I'd like
> > CXF to also do this.
> >
> > -Chris
> >
> > -----Original Message-----
> > From: Dan Diephouse [mailto:dan@envoisolutions.com]
> > Sent: Monday, April 23, 2007 4:57 PM
> > To: cxf-user@incubator.apache.org
> > Subject: Re: How To Get Object From SOAP Header?
> >
> > I did one project where we did this via an Interceptor and a
> > wsdl post processor. We wrote the WSDL without the header,
> > generated the code, then at runtime we modified the WSDL
> > document to add in the header. Our Interceptor was then
> > responsible for parsing the header and authentication.
> >
> > I would like to find a better way to do this though. Maybe a
> > flag to disable headers inside wsdl2java?
> >
> > Cheers,
> > - Dan
> >
> > On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
> > > To bring up a point from a couple of weeks ago:
> > >
> > > I agree with Matthew-- CXF should support SOAP headers that are
> >
> > defined
> >
> > > in their own message (rather than having to make the header
> >
> > a part in
> >
> > > the operation's request message).  This is much more concise and
> > > is often seen in the real world.  This is the way that the
> >
> > salesforce.com
> >
> > > enterprise WSDL is defined, as well as the eBay WSDL.
> > >
> > > Is this something that CXF could easily support?
> > >
> > > -Chris
> > >
> > > -----Original Message-----
> > > From: Matthew Good [mailto:matt_good@yahoo.com]
> > > Sent: Thursday, April 05, 2007 3:11 PM
> > > To: cxf-user@incubator.apache.org
> > > Subject: RE: How To Get Object From SOAP Header?
> > >
> > > WS-I 2208 is a "MAY" clause.  So using separate messages is WS-I
> > > compliant.  (You scared me for a second).
> > >
> > > The wrapped vs. bare is not explicitly set in the wsdl.  Sure it
> > > is somewhat specified based on those rules in jax-ws but a source
> > > generation tool should have an option to override that as
> >
> > best it can.
> >
> > > As far as interoperability, WS-I is the only thing that we
> >
> > should have
> >
> > > to abide by (jax-ws - Java!).  In .NET there is a switch
> >
> > for wrapped
> >
> > > vs. bare and I have found nothing that matters from an
> > > interoperability standpoint which way the switch is set.  The
> > > resulting SOAP message is the same.
> > >
> > > So, doc/literal yes, use it.  My opinion is that jax-ws trying to
> > > determine wrapped vs. bare based on a bunch of rules is
> >
> > absurd.  It's
> >
> > > really a developer preference.  (I am talking wsdl first
> >
> > development
> >
> > > here).
> > >
> > >
> > > --- Christopher Moesel <Ch...@avid.com>
> > >
> > > wrote:
> > > > 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:matt_good@yahoo.com]
> > > > 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/Get
> > Status"></
> >
> > > > 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 <Ch...@avid.com>
> > > >
> > > > 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:Gary.Tully@iona.com]
> > > > > 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#R220
> > >8
> > >
> > > > > [2]
> > >
> > > http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#R273
> > >8
> > >
> > > > > > -----Original Message-----
> > > > > > From: Christopher Moesel
> > > > >
> > > > > [mailto:Christopher_Moesel@avid.com]
> > > > >
> > > > > > 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:Christopher_Moesel@avid.com]
> > > > >
> > > > > > 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:Christopher_Moesel@avid.com]
> > > > >
> > > > > > 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
> > > > matthew.good@yahoo.com
> > > > 720-320-8376
> > >
> > > Matthew Good
> > > matthew.good@yahoo.com
> > > 720-320-8376
> >
> > --
> > Dan Diephouse
> > Envoi Solutions
> > http://envoisolutions.com | http://netzooid.com/blog

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
Yes, this would require the code generator to look at the physical
portion of the WSDL.  I realize it's not ideal, but... again, if it's
happening in the real world, it needs to be considered.  Has CXF been
tested as a client against eBay and Salesforce.com?

-Chris

-----Original Message-----
From: Johnson, Eric [mailto:Eric.Johnson@iona.com] 
Sent: Monday, April 23, 2007 5:17 PM
To: cxf-user@incubator.apache.org
Subject: RE: How To Get Object From SOAP Header?

To do what you ask the code generators would need to generate code based
on the contents of the physical portion of the WSDL (aka the
wsdl:binding element) correct?


> -----Original Message-----
> From: Christopher Moesel [mailto:Christopher_Moesel@avid.com] 
> Sent: Monday, April 23, 2007 5:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
> 
> Dan-- I think you may be talking about a slightly different issue?
> 
> I don't want to disable headers inside wsdl2java.  What I 
> want is for wsdl2java to generate the header parameters in 
> the interface even if the header object is not a part of the 
> operation input (or output) message.
> 
> For example, I want the following WSDL to cause the 
> UserCredentialsType object to be passed in through the 
> generated interface:
> 
> <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>
> <!-- imagine other messages here... -->
> 
> <wsdl:operation name="MyOperation">
>   <soap:operation soapAction=""/>
>   <wsdl:input>
>     <soap:header message="tns:UserCredentials" part="credentials"
> use="literal" />
>     <soap:body use="literal"/>
>   </wsdl:input>
>   <!-- imagine a wsdl:output and wsdl:fault here... --> 
> </wsdl:operation>
> 
> The current CXF wsdl2java will not create a parameter for the 
> UserCredentialsType object, because it is not a wsdl:part of 
> the MyOperationRequest message.  This current behavior 
> appears to be based on recommendation by WS-I (but not a 
> mandatory rule by WS-I).
> 
> XFire does indeed generate the header object parameter as 
> expected in this case.  I think XFire does the right thing, 
> based on what I see out there in the real world.  I'd like 
> CXF to also do this.
> 
> -Chris
> 
> -----Original Message-----
> From: Dan Diephouse [mailto:dan@envoisolutions.com]
> Sent: Monday, April 23, 2007 4:57 PM
> To: cxf-user@incubator.apache.org
> Subject: Re: How To Get Object From SOAP Header?
> 
> I did one project where we did this via an Interceptor and a 
> wsdl post processor. We wrote the WSDL without the header, 
> generated the code, then at runtime we modified the WSDL 
> document to add in the header. Our Interceptor was then 
> responsible for parsing the header and authentication.
> 
> I would like to find a better way to do this though. Maybe a 
> flag to disable headers inside wsdl2java?
> 
> Cheers,
> - Dan
> 
> On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
> >
> > To bring up a point from a couple of weeks ago:
> >
> > I agree with Matthew-- CXF should support SOAP headers that are
> defined
> > in their own message (rather than having to make the header 
> a part in 
> > the operation's request message).  This is much more concise and is 
> > often seen in the real world.  This is the way that the 
> salesforce.com 
> > enterprise WSDL is defined, as well as the eBay WSDL.
> >
> > Is this something that CXF could easily support?
> >
> > -Chris
> >
> > -----Original Message-----
> > From: Matthew Good [mailto:matt_good@yahoo.com]
> > Sent: Thursday, April 05, 2007 3:11 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: How To Get Object From SOAP Header?
> >
> > WS-I 2208 is a "MAY" clause.  So using separate messages is WS-I 
> > compliant.  (You scared me for a second).
> >
> > The wrapped vs. bare is not explicitly set in the wsdl.  Sure it is 
> > somewhat specified based on those rules in jax-ws but a source 
> > generation tool should have an option to override that as 
> best it can.
> >
> > As far as interoperability, WS-I is the only thing that we 
> should have 
> > to abide by (jax-ws - Java!).  In .NET there is a switch 
> for wrapped 
> > vs. bare and I have found nothing that matters from an 
> > interoperability standpoint which way the switch is set.  The 
> > resulting SOAP message is the same.
> >
> > So, doc/literal yes, use it.  My opinion is that jax-ws trying to 
> > determine wrapped vs. bare based on a bunch of rules is 
> absurd.  It's 
> > really a developer preference.  (I am talking wsdl first 
> development 
> > here).
> >
> >
> > --- Christopher Moesel <Ch...@avid.com>
> > wrote:
> >
> > > 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:matt_good@yahoo.com]
> > > 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/Get
> Status"></
> > > 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 <Ch...@avid.com>
> > > 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:Gary.Tully@iona.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > > 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:Christopher_Moesel@avid.com]
> > > > > 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:Christopher_Moesel@avid.com]
> > > > > 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
> > > matthew.good@yahoo.com
> > > 720-320-8376
> > >
> >
> >
> > Matthew Good
> > matthew.good@yahoo.com
> > 720-320-8376
> >
> 
> 
> 
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 

RE: How To Get Object From SOAP Header?

Posted by "Johnson, Eric" <Er...@iona.com>.
To do what you ask the code generators would need to generate code based
on the contents of the physical portion of the WSDL (aka the
wsdl:binding element) correct?


> -----Original Message-----
> From: Christopher Moesel [mailto:Christopher_Moesel@avid.com] 
> Sent: Monday, April 23, 2007 5:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
> 
> Dan-- I think you may be talking about a slightly different issue?
> 
> I don't want to disable headers inside wsdl2java.  What I 
> want is for wsdl2java to generate the header parameters in 
> the interface even if the header object is not a part of the 
> operation input (or output) message.
> 
> For example, I want the following WSDL to cause the 
> UserCredentialsType object to be passed in through the 
> generated interface:
> 
> <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>
> <!-- imagine other messages here... -->
> 
> <wsdl:operation name="MyOperation">
>   <soap:operation soapAction=""/>
>   <wsdl:input>
>     <soap:header message="tns:UserCredentials" part="credentials"
> use="literal" />
>     <soap:body use="literal"/>
>   </wsdl:input>
>   <!-- imagine a wsdl:output and wsdl:fault here... --> 
> </wsdl:operation>
> 
> The current CXF wsdl2java will not create a parameter for the 
> UserCredentialsType object, because it is not a wsdl:part of 
> the MyOperationRequest message.  This current behavior 
> appears to be based on recommendation by WS-I (but not a 
> mandatory rule by WS-I).
> 
> XFire does indeed generate the header object parameter as 
> expected in this case.  I think XFire does the right thing, 
> based on what I see out there in the real world.  I'd like 
> CXF to also do this.
> 
> -Chris
> 
> -----Original Message-----
> From: Dan Diephouse [mailto:dan@envoisolutions.com]
> Sent: Monday, April 23, 2007 4:57 PM
> To: cxf-user@incubator.apache.org
> Subject: Re: How To Get Object From SOAP Header?
> 
> I did one project where we did this via an Interceptor and a 
> wsdl post processor. We wrote the WSDL without the header, 
> generated the code, then at runtime we modified the WSDL 
> document to add in the header. Our Interceptor was then 
> responsible for parsing the header and authentication.
> 
> I would like to find a better way to do this though. Maybe a 
> flag to disable headers inside wsdl2java?
> 
> Cheers,
> - Dan
> 
> On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
> >
> > To bring up a point from a couple of weeks ago:
> >
> > I agree with Matthew-- CXF should support SOAP headers that are
> defined
> > in their own message (rather than having to make the header 
> a part in 
> > the operation's request message).  This is much more concise and is 
> > often seen in the real world.  This is the way that the 
> salesforce.com 
> > enterprise WSDL is defined, as well as the eBay WSDL.
> >
> > Is this something that CXF could easily support?
> >
> > -Chris
> >
> > -----Original Message-----
> > From: Matthew Good [mailto:matt_good@yahoo.com]
> > Sent: Thursday, April 05, 2007 3:11 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: How To Get Object From SOAP Header?
> >
> > WS-I 2208 is a "MAY" clause.  So using separate messages is WS-I 
> > compliant.  (You scared me for a second).
> >
> > The wrapped vs. bare is not explicitly set in the wsdl.  Sure it is 
> > somewhat specified based on those rules in jax-ws but a source 
> > generation tool should have an option to override that as 
> best it can.
> >
> > As far as interoperability, WS-I is the only thing that we 
> should have 
> > to abide by (jax-ws - Java!).  In .NET there is a switch 
> for wrapped 
> > vs. bare and I have found nothing that matters from an 
> > interoperability standpoint which way the switch is set.  The 
> > resulting SOAP message is the same.
> >
> > So, doc/literal yes, use it.  My opinion is that jax-ws trying to 
> > determine wrapped vs. bare based on a bunch of rules is 
> absurd.  It's 
> > really a developer preference.  (I am talking wsdl first 
> development 
> > here).
> >
> >
> > --- Christopher Moesel <Ch...@avid.com>
> > wrote:
> >
> > > 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:matt_good@yahoo.com]
> > > 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/Get
> Status"></
> > > 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 <Ch...@avid.com>
> > > 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:Gary.Tully@iona.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > > 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:Christopher_Moesel@avid.com]
> > > > > 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:Christopher_Moesel@avid.com]
> > > > > 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
> > > matthew.good@yahoo.com
> > > 720-320-8376
> > >
> >
> >
> > Matthew Good
> > matthew.good@yahoo.com
> > 720-320-8376
> >
> 
> 
> 
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
Please excuse the very poorly formatted XML.  It appears that my email
client likes to add and remove newlines randomly.

-Chris

-----Original Message-----
From: Christopher Moesel [mailto:Christopher_Moesel@avid.com] 
Sent: Monday, April 23, 2007 5:11 PM
To: cxf-user@incubator.apache.org
Subject: RE: How To Get Object From SOAP Header?

Dan-- I think you may be talking about a slightly different issue?

I don't want to disable headers inside wsdl2java.  What I want is for
wsdl2java to generate the header parameters in the interface even if the
header object is not a part of the operation input (or output) message.

For example, I want the following WSDL to cause the UserCredentialsType
object to be passed in through the generated interface:

<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>
<!-- imagine other messages here... -->

<wsdl:operation name="MyOperation">
  <soap:operation soapAction=""/>
  <wsdl:input>
    <soap:header message="tns:UserCredentials" part="credentials"
use="literal" />
    <soap:body use="literal"/>
  </wsdl:input>
  <!-- imagine a wsdl:output and wsdl:fault here... -->
</wsdl:operation>

The current CXF wsdl2java will not create a parameter for the
UserCredentialsType object, because it is not a wsdl:part of the
MyOperationRequest message.  This current behavior appears to be based
on recommendation by WS-I (but not a mandatory rule by WS-I).

XFire does indeed generate the header object parameter as expected in
this case.  I think XFire does the right thing, based on what I see out
there in the real world.  I'd like CXF to also do this.

-Chris

-----Original Message-----
From: Dan Diephouse [mailto:dan@envoisolutions.com] 
Sent: Monday, April 23, 2007 4:57 PM
To: cxf-user@incubator.apache.org
Subject: Re: How To Get Object From SOAP Header?

I did one project where we did this via an Interceptor and a wsdl post
processor. We wrote the WSDL without the header, generated the code,
then at
runtime we modified the WSDL document to add in the header. Our
Interceptor
was then responsible for parsing the header and authentication.

I would like to find a better way to do this though. Maybe a flag to
disable
headers inside wsdl2java?

Cheers,
- Dan

On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
>
> To bring up a point from a couple of weeks ago:
>
> I agree with Matthew-- CXF should support SOAP headers that are
defined
> in their own message (rather than having to make the header a part in
> the operation's request message).  This is much more concise and is
> often seen in the real world.  This is the way that the salesforce.com
> enterprise WSDL is defined, as well as the eBay WSDL.
>
> Is this something that CXF could easily support?
>
> -Chris
>
> -----Original Message-----
> From: Matthew Good [mailto:matt_good@yahoo.com]
> Sent: Thursday, April 05, 2007 3:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
>
> WS-I 2208 is a "MAY" clause.  So using separate
> messages is WS-I compliant.  (You scared me for a
> second).
>
> The wrapped vs. bare is not explicitly set in the
> wsdl.  Sure it is somewhat specified based on those
> rules in jax-ws but a source generation tool should
> have an option to override that as best it can.
>
> As far as interoperability, WS-I is the only thing
> that we should have to abide by (jax-ws - Java!).  In
> .NET there is a switch for wrapped vs. bare and I have
> found nothing that matters from an interoperability
> standpoint which way the switch is set.  The resulting
> SOAP message is the same.
>
> So, doc/literal yes, use it.  My opinion is that
> jax-ws trying to determine wrapped vs. bare based on a
> bunch of rules is absurd.  It's really a developer
> preference.  (I am talking wsdl first development
> here).
>
>
> --- Christopher Moesel <Ch...@avid.com>
> wrote:
>
> > 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:matt_good@yahoo.com]
> > 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 <Ch...@avid.com>
> > 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:Gary.Tully@iona.com]
> > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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
> > matthew.good@yahoo.com
> > 720-320-8376
> >
>
>
> Matthew Good
> matthew.good@yahoo.com
> 720-320-8376
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
Dan-- I think you may be talking about a slightly different issue?

I don't want to disable headers inside wsdl2java.  What I want is for
wsdl2java to generate the header parameters in the interface even if the
header object is not a part of the operation input (or output) message.

For example, I want the following WSDL to cause the UserCredentialsType
object to be passed in through the generated interface:

<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>
<!-- imagine other messages here... -->

<wsdl:operation name="MyOperation">
  <soap:operation soapAction=""/>
  <wsdl:input>
    <soap:header message="tns:UserCredentials" part="credentials"
use="literal" />
    <soap:body use="literal"/>
  </wsdl:input>
  <!-- imagine a wsdl:output and wsdl:fault here... -->
</wsdl:operation>

The current CXF wsdl2java will not create a parameter for the
UserCredentialsType object, because it is not a wsdl:part of the
MyOperationRequest message.  This current behavior appears to be based
on recommendation by WS-I (but not a mandatory rule by WS-I).

XFire does indeed generate the header object parameter as expected in
this case.  I think XFire does the right thing, based on what I see out
there in the real world.  I'd like CXF to also do this.

-Chris

-----Original Message-----
From: Dan Diephouse [mailto:dan@envoisolutions.com] 
Sent: Monday, April 23, 2007 4:57 PM
To: cxf-user@incubator.apache.org
Subject: Re: How To Get Object From SOAP Header?

I did one project where we did this via an Interceptor and a wsdl post
processor. We wrote the WSDL without the header, generated the code,
then at
runtime we modified the WSDL document to add in the header. Our
Interceptor
was then responsible for parsing the header and authentication.

I would like to find a better way to do this though. Maybe a flag to
disable
headers inside wsdl2java?

Cheers,
- Dan

On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
>
> To bring up a point from a couple of weeks ago:
>
> I agree with Matthew-- CXF should support SOAP headers that are
defined
> in their own message (rather than having to make the header a part in
> the operation's request message).  This is much more concise and is
> often seen in the real world.  This is the way that the salesforce.com
> enterprise WSDL is defined, as well as the eBay WSDL.
>
> Is this something that CXF could easily support?
>
> -Chris
>
> -----Original Message-----
> From: Matthew Good [mailto:matt_good@yahoo.com]
> Sent: Thursday, April 05, 2007 3:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
>
> WS-I 2208 is a "MAY" clause.  So using separate
> messages is WS-I compliant.  (You scared me for a
> second).
>
> The wrapped vs. bare is not explicitly set in the
> wsdl.  Sure it is somewhat specified based on those
> rules in jax-ws but a source generation tool should
> have an option to override that as best it can.
>
> As far as interoperability, WS-I is the only thing
> that we should have to abide by (jax-ws - Java!).  In
> .NET there is a switch for wrapped vs. bare and I have
> found nothing that matters from an interoperability
> standpoint which way the switch is set.  The resulting
> SOAP message is the same.
>
> So, doc/literal yes, use it.  My opinion is that
> jax-ws trying to determine wrapped vs. bare based on a
> bunch of rules is absurd.  It's really a developer
> preference.  (I am talking wsdl first development
> here).
>
>
> --- Christopher Moesel <Ch...@avid.com>
> wrote:
>
> > 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:matt_good@yahoo.com]
> > 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 <Ch...@avid.com>
> > 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:Gary.Tully@iona.com]
> > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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
> > matthew.good@yahoo.com
> > 720-320-8376
> >
>
>
> Matthew Good
> matthew.good@yahoo.com
> 720-320-8376
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: How To Get Object From SOAP Header?

Posted by Dan Diephouse <da...@envoisolutions.com>.
I did one project where we did this via an Interceptor and a wsdl post
processor. We wrote the WSDL without the header, generated the code, then at
runtime we modified the WSDL document to add in the header. Our Interceptor
was then responsible for parsing the header and authentication.

I would like to find a better way to do this though. Maybe a flag to disable
headers inside wsdl2java?

Cheers,
- Dan

On 4/23/07, Christopher Moesel <Ch...@avid.com> wrote:
>
> To bring up a point from a couple of weeks ago:
>
> I agree with Matthew-- CXF should support SOAP headers that are defined
> in their own message (rather than having to make the header a part in
> the operation's request message).  This is much more concise and is
> often seen in the real world.  This is the way that the salesforce.com
> enterprise WSDL is defined, as well as the eBay WSDL.
>
> Is this something that CXF could easily support?
>
> -Chris
>
> -----Original Message-----
> From: Matthew Good [mailto:matt_good@yahoo.com]
> Sent: Thursday, April 05, 2007 3:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
>
> WS-I 2208 is a "MAY" clause.  So using separate
> messages is WS-I compliant.  (You scared me for a
> second).
>
> The wrapped vs. bare is not explicitly set in the
> wsdl.  Sure it is somewhat specified based on those
> rules in jax-ws but a source generation tool should
> have an option to override that as best it can.
>
> As far as interoperability, WS-I is the only thing
> that we should have to abide by (jax-ws - Java!).  In
> .NET there is a switch for wrapped vs. bare and I have
> found nothing that matters from an interoperability
> standpoint which way the switch is set.  The resulting
> SOAP message is the same.
>
> So, doc/literal yes, use it.  My opinion is that
> jax-ws trying to determine wrapped vs. bare based on a
> bunch of rules is absurd.  It's really a developer
> preference.  (I am talking wsdl first development
> here).
>
>
> --- Christopher Moesel <Ch...@avid.com>
> wrote:
>
> > 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:matt_good@yahoo.com]
> > 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 <Ch...@avid.com>
> > 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:Gary.Tully@iona.com]
> > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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
> > matthew.good@yahoo.com
> > 720-320-8376
> >
>
>
> Matthew Good
> matthew.good@yahoo.com
> 720-320-8376
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: wsdlLocation removed from demo's impl code?

Posted by Daniel Kulp <dk...@apache.org>.
Jervis and James,

The wsdlLocation was removed from the generated SEI interface, not the 
impl.   I'm not sure if it was ever generated into the impl.   I don't 
really know.    In anycase, this was to make the generated SEI 
more "portable" (usable on client and server side where paths to wsdl's 
would be very different) as well as make it more consistent with code 
generated from the JAX-WS RI which makes porting apps from the RI to CXF 
easier.


On Tuesday 24 April 2007 03:04, James Mao wrote:
> Add the wsdlLocation attribute into the annotation, is the easiest way
> to fix the problem.
> However we can raise two issues:
>
> * Why in jaxws case, the buildFromWsdl and buildFromClass generate two
> different results

That's a good question.   Probably some bugs someplace.  :-(

> * Besides jaxws annotation, is there another way to select
> specifically from wsdl/class

Kind of....   For the server side, the jaxws spec allows you to pass the 
wsdl into the endpoint via the endpoint.setMetadata(List<Source>) call.   
However, I don't think that's implemented yet.   :-(

In CXF, we have a "hidden" method (the yoko tests use this):

You can call: 
endpoint.getProperies().set("javax.xml.ws.wsdl.description", "path/to/wsdl");
before calling publish to set the wsdlLocation that is used.

Dan


> James.
>
> > Hi,
> >
> > I am currently looking into CXF-584 (hello_world sample (Running
> > demo with HTTP Get section) doesn't work), the cause of this problem
> > is because wsdlLocation attribute was removed from server's impl
> > code (take a look into GreeterImpl.java). We now load server side
> > service module from class instead of from WSDL. While we will keep
> > fixing bugs discovered in code-first approach, I still like to see
> > our demos building service module from WSDL by default, in order to
> > be consistent with previous behaviors. Before I put back the
> > wsdlLocation, can someone shed some light on why wsdlLocation was
> > removed?  I just vaguely remembered this is related to some WSDL
> > path resolving issues.
> >
> > Thanks,
> > Jervis

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: wsdlLocation removed from demo's impl code?

Posted by James Mao <ja...@iona.com>.
Add the wsdlLocation attribute into the annotation, is the easiest way 
to fix the problem.
However we can raise two issues:

* Why in jaxws case, the buildFromWsdl and buildFromClass generate two 
different results
* Besides jaxws annotation, is there another way to select specifically 
from wsdl/class

James.
> Hi,
>
> I am currently looking into CXF-584 (hello_world sample (Running demo with HTTP Get section) doesn't work), the cause of this problem is because wsdlLocation attribute was removed from server's impl code (take a look into GreeterImpl.java). We now load server side service module from class instead of from WSDL. While we will keep fixing bugs discovered in code-first approach, I still like to see our demos building service module from WSDL by default, in order to be consistent with previous behaviors. Before I put back the wsdlLocation, can someone shed some light on why wsdlLocation was removed?  I just vaguely remembered this is related to some WSDL path resolving issues.
>
> Thanks,
> Jervis
>
>   


wsdlLocation removed from demo's impl code?

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi,

I am currently looking into CXF-584 (hello_world sample (Running demo with HTTP Get section) doesn't work), the cause of this problem is because wsdlLocation attribute was removed from server's impl code (take a look into GreeterImpl.java). We now load server side service module from class instead of from WSDL. While we will keep fixing bugs discovered in code-first approach, I still like to see our demos building service module from WSDL by default, in order to be consistent with previous behaviors. Before I put back the wsdlLocation, can someone shed some light on why wsdlLocation was removed?  I just vaguely remembered this is related to some WSDL path resolving issues.

Thanks,
Jervis

Re: How To Get Object From SOAP Header?

Posted by James Mao <ja...@iona.com>.
Hi,

Yea, i think we should take this seriously now, i would like to collect 
the requirement here, if this is most of our users want,
We must create jira issues asap.

Recently a co-worker of mine called me, asked the same  thing, he has 
bunch of idl, and converted to wsdl, and he used the cxf tools,
which generated bunch of doc-lit-wrapped style java code, but this is 
not what he want, he want bare style.
So, at that time, the only thing i suggest he to do is to break one of 
the jaxws wrapped checking rules. in this way to generate bare style.
After that i'm also thinking of adding an wrapped/bare option to 
cxfwsdl2java tools.

So, here we two issues raised,
 
* wsdl2java support soap header in a different message
* wsdl2java support wrapped/bare option

if there is no object, we can create a formal requirement through jira[1]

[1] https://issues.apache.org/jira/browse/CXF


Thanks,
James.




> To bring up a point from a couple of weeks ago:
>
> I agree with Matthew-- CXF should support SOAP headers that are defined
> in their own message (rather than having to make the header a part in
> the operation's request message).  This is much more concise and is
> often seen in the real world.  This is the way that the salesforce.com
> enterprise WSDL is defined, as well as the eBay WSDL.
>
> Is this something that CXF could easily support?
>
> -Chris
>
> -----Original Message-----
> From: Matthew Good [mailto:matt_good@yahoo.com] 
> Sent: Thursday, April 05, 2007 3:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
>
> WS-I 2208 is a "MAY" clause.  So using separate
> messages is WS-I compliant.  (You scared me for a
> second).  
>
> The wrapped vs. bare is not explicitly set in the
> wsdl.  Sure it is somewhat specified based on those
> rules in jax-ws but a source generation tool should
> have an option to override that as best it can.  
>
> As far as interoperability, WS-I is the only thing
> that we should have to abide by (jax-ws - Java!).  In
> .NET there is a switch for wrapped vs. bare and I have
> found nothing that matters from an interoperability
> standpoint which way the switch is set.  The resulting
> SOAP message is the same.
>
> So, doc/literal yes, use it.  My opinion is that
> jax-ws trying to determine wrapped vs. bare based on a
> bunch of rules is absurd.  It's really a developer
> preference.  (I am talking wsdl first development
> here).
>
>
> --- Christopher Moesel <Ch...@avid.com>
> wrote:
>
>   
>> 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:matt_good@yahoo.com] 
>> 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 <Ch...@avid.com>
>> 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:Gary.Tully@iona.com] 
>>> 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:Christopher_Moesel@avid.com] 
>>>       
>>>> 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:Christopher_Moesel@avid.com]
>>>       
>>>> 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:Christopher_Moesel@avid.com]
>>>       
>>>> 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
>> matthew.good@yahoo.com
>> 720-320-8376
>>
>>     
>
>
> Matthew Good
> matthew.good@yahoo.com
> 720-320-8376
>
>   


RE: How To Get Object From SOAP Header?

Posted by "Sakala, Adinarayana" <ad...@iona.com>.
+1
I see this also as a very important requirement.
It's very common to have headers that are not part of an operations
request message.

Thanks,
Adi Sakala

> -----Original Message-----
> From: Christopher Moesel [mailto:Christopher_Moesel@avid.com]
> Sent: Monday, April 23, 2007 4:27 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
> 
> To bring up a point from a couple of weeks ago:
> 
> I agree with Matthew-- CXF should support SOAP headers that are
defined
> in their own message (rather than having to make the header a part in
> the operation's request message).  This is much more concise and is
> often seen in the real world.  This is the way that the salesforce.com
> enterprise WSDL is defined, as well as the eBay WSDL.
> 
> Is this something that CXF could easily support?
> 
> -Chris
> 
> -----Original Message-----
> From: Matthew Good [mailto:matt_good@yahoo.com]
> Sent: Thursday, April 05, 2007 3:11 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: How To Get Object From SOAP Header?
> 
> WS-I 2208 is a "MAY" clause.  So using separate
> messages is WS-I compliant.  (You scared me for a
> second).
> 
> The wrapped vs. bare is not explicitly set in the
> wsdl.  Sure it is somewhat specified based on those
> rules in jax-ws but a source generation tool should
> have an option to override that as best it can.
> 
> As far as interoperability, WS-I is the only thing
> that we should have to abide by (jax-ws - Java!).  In
> .NET there is a switch for wrapped vs. bare and I have
> found nothing that matters from an interoperability
> standpoint which way the switch is set.  The resulting
> SOAP message is the same.
> 
> So, doc/literal yes, use it.  My opinion is that
> jax-ws trying to determine wrapped vs. bare based on a
> bunch of rules is absurd.  It's really a developer
> preference.  (I am talking wsdl first development
> here).
> 
> 
> --- Christopher Moesel <Ch...@avid.com>
> wrote:
> 
> > 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:matt_good@yahoo.com]
> > 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 <Ch...@avid.com>
> > 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:Gary.Tully@iona.com]
> > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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:Christopher_Moesel@avid.com]
> > > > 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
> > matthew.good@yahoo.com
> > 720-320-8376
> >
> 
> 
> Matthew Good
> matthew.good@yahoo.com
> 720-320-8376

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
To bring up a point from a couple of weeks ago:

I agree with Matthew-- CXF should support SOAP headers that are defined
in their own message (rather than having to make the header a part in
the operation's request message).  This is much more concise and is
often seen in the real world.  This is the way that the salesforce.com
enterprise WSDL is defined, as well as the eBay WSDL.

Is this something that CXF could easily support?

-Chris

-----Original Message-----
From: Matthew Good [mailto:matt_good@yahoo.com] 
Sent: Thursday, April 05, 2007 3:11 PM
To: cxf-user@incubator.apache.org
Subject: RE: How To Get Object From SOAP Header?

WS-I 2208 is a "MAY" clause.  So using separate
messages is WS-I compliant.  (You scared me for a
second).  

The wrapped vs. bare is not explicitly set in the
wsdl.  Sure it is somewhat specified based on those
rules in jax-ws but a source generation tool should
have an option to override that as best it can.  

As far as interoperability, WS-I is the only thing
that we should have to abide by (jax-ws - Java!).  In
.NET there is a switch for wrapped vs. bare and I have
found nothing that matters from an interoperability
standpoint which way the switch is set.  The resulting
SOAP message is the same.

So, doc/literal yes, use it.  My opinion is that
jax-ws trying to determine wrapped vs. bare based on a
bunch of rules is absurd.  It's really a developer
preference.  (I am talking wsdl first development
here).


--- Christopher Moesel <Ch...@avid.com>
wrote:

> 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:matt_good@yahoo.com] 
> 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 <Ch...@avid.com>
> 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:Gary.Tully@iona.com] 
> > 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:Christopher_Moesel@avid.com] 
> > > 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:Christopher_Moesel@avid.com]
> > > 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:Christopher_Moesel@avid.com]
> > > 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
> matthew.good@yahoo.com
> 720-320-8376
> 


Matthew Good
matthew.good@yahoo.com
720-320-8376

RE: How To Get Object From SOAP Header?

Posted by Matthew Good <ma...@yahoo.com>.
WS-I 2208 is a "MAY" clause.  So using separate
messages is WS-I compliant.  (You scared me for a
second).  

The wrapped vs. bare is not explicitly set in the
wsdl.  Sure it is somewhat specified based on those
rules in jax-ws but a source generation tool should
have an option to override that as best it can.  

As far as interoperability, WS-I is the only thing
that we should have to abide by (jax-ws - Java!).  In
.NET there is a switch for wrapped vs. bare and I have
found nothing that matters from an interoperability
standpoint which way the switch is set.  The resulting
SOAP message is the same.

So, doc/literal yes, use it.  My opinion is that
jax-ws trying to determine wrapped vs. bare based on a
bunch of rules is absurd.  It's really a developer
preference.  (I am talking wsdl first development
here).


--- Christopher Moesel <Ch...@avid.com>
wrote:

> 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:matt_good@yahoo.com] 
> 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 <Ch...@avid.com>
> 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:Gary.Tully@iona.com] 
> > 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:Christopher_Moesel@avid.com] 
> > > 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:Christopher_Moesel@avid.com]
> > > 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:Christopher_Moesel@avid.com]
> > > 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
> matthew.good@yahoo.com
> 720-320-8376
> 


Matthew Good
matthew.good@yahoo.com
720-320-8376

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
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:matt_good@yahoo.com] 
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 <Ch...@avid.com>
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:Gary.Tully@iona.com] 
> 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:Christopher_Moesel@avid.com] 
> > 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:Christopher_Moesel@avid.com]
> > 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:Christopher_Moesel@avid.com]
> > 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
matthew.good@yahoo.com
720-320-8376

RE: How To Get Object From SOAP Header?

Posted by Matthew Good <ma...@yahoo.com>.
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 <Ch...@avid.com>
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:Gary.Tully@iona.com] 
> 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:Christopher_Moesel@avid.com] 
> > 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:Christopher_Moesel@avid.com]
> > 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:Christopher_Moesel@avid.com]
> > 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
matthew.good@yahoo.com
720-320-8376

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
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:Gary.Tully@iona.com] 
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:Christopher_Moesel@avid.com] 
> 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:Christopher_Moesel@avid.com]
> 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:Christopher_Moesel@avid.com]
> 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
> 

RE: How To Get Object From SOAP Header?

Posted by "Tully, Gary" <Ga...@iona.com>.
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:Christopher_Moesel@avid.com] 
> 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:Christopher_Moesel@avid.com]
> 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:Christopher_Moesel@avid.com]
> 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
> 

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
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:Christopher_Moesel@avid.com] 
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:Christopher_Moesel@avid.com] 
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

RE: How To Get Object From SOAP Header?

Posted by Christopher Moesel <Ch...@avid.com>.
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:Christopher_Moesel@avid.com] 
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