Hi Eric,

In WSDL first approach, WSDL is a "master" of type definitions for your request 
and responses. In WSDL first example the GetCustomersByName is declared as 
complex type in xml schema (inside CustomerService.wsdl), therefore JAXB 
generates corresponded java class (GetCustomersByName.java).
In contrast, java first hasn't xml schema and WSDL file, the request / response 
XML types are determined based on arguments and return java types of the method 
in class annotated with @WebService (HelloWorld.java).
As far as method returns just a string, JAX-WS framework have to wrap it into 
valid XML. By default the method name ("sayHi") is used as name of wrapper 
request element and method name + "Reponse" (sayHiResponse) as response wrapper 
element.

Regards,
Andrei.

> -----Original Message-----
> From: Eric J. Van der Velden [mailto:ericjvandervel...@gmail.com]
> Sent: Donnerstag, 26. Oktober 2017 10:25
> To: users@cxf.apache.org
> Subject: Re: In the java_first_jaxws sample of cxf there are no SayHi and
> SayHiResponse types.
> 
> So why is the wrapper type SayHi in java_first_jaxws not needed and in
> wsdl_first the wrapper type GetCustomersByName is needed?
> 
> Thanks!
> 
> On Thu, Oct 26, 2017 at 9:49 AM, Eric J. Van der Velden <
> ericjvandervel...@gmail.com> wrote:
> 
> > Thanks. But I do not understand it 100%. In the wsdl_first sample
> > there are generated: GetCustomersByName (and
> > GetCustomersByNameReponse). I create the WAR with
> > GetCustomersByName.class in WEB-INF/classes, deploy it in Tomcat and
> > it works. Now I remove GetCustomersByName.class and restart Tomcat. Now
> I get an error:
> >
> > </pre><p><b>Root Cause</b></p><pre>java.lang.NoClassDefFoundError:
> > com/example/customerservice/GetCustomersByName
> >
> > So why is this wrapper type in wsdl_first not generated
> >
> > On Wed, Oct 25, 2017 at 10:49 PM, Andrei Shakirin
> > <ashaki...@talend.com>
> > wrote:
> >
> >> Hi,
> >>
> >> The SayHi and SayHiResponse are just wrappers around string
> >> request/response. They are necessary, because only a string cannot be
> >> sent as a valid XML.
> >> The wrapper types are generated by default on the base of method name
> >> (sayHi), so you don't need to define them explicitly in java code.
> >> You can customize the wrapper using javax.xml.ws.RequestWrapper and
> >> javax.xml.ws.ResponseWrapper annotations.
> >> Please refer JAX-WS spec for further details:
> >> https://jcp.org/aboutJava/communityprocess/mrel/jsr224/index3.html
> >>
> >> Regards,
> >> Andrei.
> >>
> >>
> >> > -----Original Message-----
> >> > From: Eric J. Van der Velden [mailto:ericjvandervel...@gmail.com]
> >> > Sent: Mittwoch, 25. Oktober 2017 15:47
> >> > To: users@cxf.apache.org
> >> > Subject: In the java_first_jaxws sample of cxf there are no SayHi
> >> > and SayHiResponse types.
> >> >
> >> > In the java_first_jaxws sample of cxf there are for example no
> >> > SayHi and SayHiResponse types.
> >> >
> >> > Why not? Aren't they needed for (de)serialization?
> >> >
> >> > In the wsdl_first sample, types like GetCustomersByName and
> >> > GetCustomersByNameResponse are there, and in the debugger I saw
> >> > that
> >> they
> >> > are used.
> >> >
> >> > When I use java2ws, SayHi and SayHiResponse are there.
> >> >
> >> > Thanks!
> >>
> >
> >

Reply via email to