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

Reply via email to