You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Viswa.TK" <vk...@inautix.co.in> on 2008/10/07 15:01:35 UTC

POJO Types not creating in WSDL

Hi,

I am Apache CXF for Webservice. I have an interface which returns a POJO. I
have implemented CXF for this interface. But it is creating WSDL with the
type of interface only. POJO types are ignored in the WSDL while creating on
the fly. But correct WSDL is generated if i use any maven plugins. Could
some tell me the reason for this?
-- 
View this message in context: http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Fwd: POJO Types not creating in WSDL

Posted by Daniel Kulp <dk...@apache.org>.
Yep.  What you did is correct per spec.   If you want them all in the 
same namespace, you need to put the targetNamespace in the WebService 
annotation on both the interface and the impl.

I actually thing the tools are doing the wrong thing here if it's putting 
it all in a single wsdl.   We should test that a bit more. 

Dan


On Wednesday 08 October 2008, Viswa.TK wrote:
> Yes..I checked CXF samples and i have created my class based on
> java_first_spring_support sample only.
> But in my project, i have kept my interface class and webservice
> implementation class in different packages. I tried creating wsdl
> using the maven plugin and it was working properly (i.e. it contains
> all definitions of the service class and pojo's that are available).
> But wsdl is not created properly if i try on the fly (i.e. directly
> giving the url in browser. wsdl contains service class details. it
> does not have pojo elements.).
>
> just now i have solved the problem by giving same targetNamespace in
> both interface class and implementation class...
>
> but could you please tell me watever i have done is correct...if i
> dont give targetNamespace, i will have to keep my interface class and
> webservice implementation class in the same package....could you pls
> tell me the actual reason?
>
> Benson Margulies-4 wrote:
> > You still haven't told me what your data binding and  front end are.
> > Also, what is in the wsdl? An operation 'getResult'? What sort of
> > types does it refer to.
> >
> > Have you looked at our samples?
> >
> >
> > On Wed, Oct 8, 2008 at 12:32 AM, Viswa.TK
> > <vk...@inautix.co.in>
> >
> > wrote:
> >> I have created a implementation class which implements an interface
> >> with one
> >> method. The method returns a POJO class and also it takes a POJO
> >> object as
> >> parameter. i. e. it is configured as Code first.
> >> I have given annotation in both implementation class and interface
> >> class as
> >> given below
> >>
> >> Implementation class
> >> ------------------------
> >>
> >> @WebService(endpointInterface = "com.services.Myinterface",
> >> targetNamespace="http://cxf.apache.org")
> >> public class MyServices implements Myinterface {
> >>
> >>   public DemoPOJO getResult(RequestInfo requestInfo)   throws
> >> Exception { }
> >>
> >> Interface class
> >> -------------------------
> >>
> >> @WebService
> >> public interface Myinterface {
> >>        public DemoPOJO getResult(@WebParam(name="requestInfo")
> >> RequestInfo
> >> requestInfo) throws Exception;
> >> }
> >>
> >> spring beans.xml
> >> --------------------------
> >>
> >>        <jaxws:endpoint
> >>                  id="resultView"
> >>                  address="/resultView">
> >>                  <jaxws:implementor>
> >>                         <bean id="myServices"
> >> class="com.services.MyServices">
> >>                                <property name="aViewService"
> >> ref="aViewService" />
> >>                </bean>
> >>                  </jaxws:implementor>
> >>        </jaxws:endpoint>
> >>
> >>
> >> Using the above code and configuration, WSDL has been created. But
> >> WSDL does
> >> not have the definition of the POJO's (DemoPOJO and RequestInfo).
> >>
> >> Benson Margulies-4 wrote:
> >> > But how? I am completely unable to visualize your problem from
> >> > your description. AJX-WS or Simple? JAX-B or Aegis? Code first or
> >>
> >> WSDL-first?
> >>
> >> > On Tue, Oct 7, 2008 at 9:56 AM, Viswa.TK
> >> > <vk...@inautix.co.in>
> >> >
> >> > wrote:
> >> >> Actually i have configured using CXF/Spring...
> >> >>
> >> >> Benson Margulies-4 wrote:
> >> >> > You will need to give us much more detail. How are you
> >> >> > configuring
> >>
> >> CXF?
> >>
> >> >> > On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK
> >> >> > <vk...@inautix.co.in>
> >> >> >
> >> >> > wrote:
> >> >> >> Hi,
> >> >> >>
> >> >> >> I am Apache CXF for Webservice. I have an interface which
> >> >> >> returns a
> >> >>
> >> >> POJO.
> >> >>
> >> >> >> I
> >> >> >> have implemented CXF for this interface. But it is creating
> >> >> >> WSDL
> >>
> >> with
> >>
> >> >> the
> >> >>
> >> >> >> type of interface only. POJO types are ignored in the WSDL
> >> >> >> while
> >> >>
> >> >> creating
> >> >>
> >> >> >> on
> >> >> >> the fly. But correct WSDL is generated if i use any maven
> >> >> >> plugins.
> >> >>
> >> >> Could
> >> >>
> >> >> >> some tell me the reason for this?
> >> >> >> --
> >> >> >> View this message in context:
> >>
> >> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19
> >>857670.html
> >>
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >>
> >> >> --
> >> >> View this message in context:
> >>
> >> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19
> >>858734.html
> >>
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19
> >>872139.html Sent from the cxf-user mailing list archive at
> >> Nabble.com.



-- 
J. Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Fwd: POJO Types not creating in WSDL

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Viswa.TK wrote:
> Yes..I checked CXF samples and i have created my class based on
> java_first_spring_support sample only. 
> But in my project, i have kept my interface class and webservice
> implementation class in different packages. I tried creating wsdl using the
> maven plugin and it was working properly (i.e. it contains all definitions
> of the service class and pojo's that are available). But wsdl is not created
> properly if i try on the fly (i.e. directly giving the url in browser. wsdl
> contains service class details. it does not have pojo elements.). 

When you have the interface and implementation in different packages
without an explicit targetNamespace then the JAX-WS spec puts the
implementation (the "service" in WSDL-speak) into a different namespace
from the interface (the "portType").  It's not possible to represent all
of this in a single WSDL document, as it can only have one target
namespace, so CXF must break the definition up into separate WSDLs.

The ?wsdl URL gives you an "implementation" WSDL with one
targetNamespace defining just the service, and this imports another WSDL
("?wsdl=2" or something like that) with a different targetNamespace
containing the port type, messages, schema types, etc.  If the POJOs are
in yet another namespace then you might end up with the interface WSDL
importing a separate xsd file defining those types.  If you resolve all
the imports you'll see that all the definitions are there.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Fwd: POJO Types not creating in WSDL

Posted by "Viswa.TK" <vk...@inautix.co.in>.
Yes..I checked CXF samples and i have created my class based on
java_first_spring_support sample only. 
But in my project, i have kept my interface class and webservice
implementation class in different packages. I tried creating wsdl using the
maven plugin and it was working properly (i.e. it contains all definitions
of the service class and pojo's that are available). But wsdl is not created
properly if i try on the fly (i.e. directly giving the url in browser. wsdl
contains service class details. it does not have pojo elements.). 

just now i have solved the problem by giving same targetNamespace in both
interface class and implementation class...

but could you please tell me watever i have done is correct...if i dont give
targetNamespace, i will have to keep my interface class and webservice
implementation class in the same package....could you pls tell me the actual
reason?



Benson Margulies-4 wrote:
> 
> You still haven't told me what your data binding and  front end are. Also,
> what is in the wsdl? An operation 'getResult'? What sort of types does it
> refer to.
> 
> Have you looked at our samples?
> 
> 
> On Wed, Oct 8, 2008 at 12:32 AM, Viswa.TK <vk...@inautix.co.in>
> wrote:
> 
>>
>> I have created a implementation class which implements an interface with
>> one
>> method. The method returns a POJO class and also it takes a POJO object
>> as
>> parameter. i. e. it is configured as Code first.
>> I have given annotation in both implementation class and interface class
>> as
>> given below
>>
>> Implementation class
>> ------------------------
>>
>> @WebService(endpointInterface = "com.services.Myinterface",
>> targetNamespace="http://cxf.apache.org")
>> public class MyServices implements Myinterface {
>>
>>   public DemoPOJO getResult(RequestInfo requestInfo)   throws Exception {
>> }
>>
>> Interface class
>> -------------------------
>>
>> @WebService
>> public interface Myinterface {
>>        public DemoPOJO getResult(@WebParam(name="requestInfo")
>> RequestInfo
>> requestInfo) throws Exception;
>> }
>>
>> spring beans.xml
>> --------------------------
>>
>>        <jaxws:endpoint
>>                  id="resultView"
>>                  address="/resultView">
>>                  <jaxws:implementor>
>>                         <bean id="myServices"
>> class="com.services.MyServices">
>>                                <property name="aViewService"
>> ref="aViewService" />
>>                </bean>
>>                  </jaxws:implementor>
>>        </jaxws:endpoint>
>>
>>
>> Using the above code and configuration, WSDL has been created. But WSDL
>> does
>> not have the definition of the POJO's (DemoPOJO and RequestInfo).
>>
>>
>>
>>
>> Benson Margulies-4 wrote:
>> >
>> > But how? I am completely unable to visualize your problem from your
>> > description. AJX-WS or Simple? JAX-B or Aegis? Code first or
>> WSDL-first?
>> >
>> > On Tue, Oct 7, 2008 at 9:56 AM, Viswa.TK <vk...@inautix.co.in>
>> > wrote:
>> >
>> >>
>> >> Actually i have configured using CXF/Spring...
>> >>
>> >>
>> >>
>> >> Benson Margulies-4 wrote:
>> >> >
>> >> > You will need to give us much more detail. How are you configuring
>> CXF?
>> >> >
>> >> > On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK <vk...@inautix.co.in>
>> >> > wrote:
>> >> >
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> I am Apache CXF for Webservice. I have an interface which returns a
>> >> POJO.
>> >> >> I
>> >> >> have implemented CXF for this interface. But it is creating WSDL
>> with
>> >> the
>> >> >> type of interface only. POJO types are ignored in the WSDL while
>> >> creating
>> >> >> on
>> >> >> the fly. But correct WSDL is generated if i use any maven plugins.
>> >> Could
>> >> >> some tell me the reason for this?
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
>> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19858734.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19872139.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19878557.html
Sent from the cxf-user mailing list archive at Nabble.com.


Fwd: POJO Types not creating in WSDL

Posted by Benson Margulies <bi...@gmail.com>.
You still haven't told me what your data binding and  front end are. Also,
what is in the wsdl? An operation 'getResult'? What sort of types does it
refer to.

Have you looked at our samples?


On Wed, Oct 8, 2008 at 12:32 AM, Viswa.TK <vk...@inautix.co.in> wrote:

>
> I have created a implementation class which implements an interface with
> one
> method. The method returns a POJO class and also it takes a POJO object as
> parameter. i. e. it is configured as Code first.
> I have given annotation in both implementation class and interface class as
> given below
>
> Implementation class
> ------------------------
>
> @WebService(endpointInterface = "com.services.Myinterface",
> targetNamespace="http://cxf.apache.org")
> public class MyServices implements Myinterface {
>
>   public DemoPOJO getResult(RequestInfo requestInfo)   throws Exception {
> }
>
> Interface class
> -------------------------
>
> @WebService
> public interface Myinterface {
>        public DemoPOJO getResult(@WebParam(name="requestInfo") RequestInfo
> requestInfo) throws Exception;
> }
>
> spring beans.xml
> --------------------------
>
>        <jaxws:endpoint
>                  id="resultView"
>                  address="/resultView">
>                  <jaxws:implementor>
>                         <bean id="myServices"
> class="com.services.MyServices">
>                                <property name="aViewService"
> ref="aViewService" />
>                </bean>
>                  </jaxws:implementor>
>        </jaxws:endpoint>
>
>
> Using the above code and configuration, WSDL has been created. But WSDL
> does
> not have the definition of the POJO's (DemoPOJO and RequestInfo).
>
>
>
>
> Benson Margulies-4 wrote:
> >
> > But how? I am completely unable to visualize your problem from your
> > description. AJX-WS or Simple? JAX-B or Aegis? Code first or WSDL-first?
> >
> > On Tue, Oct 7, 2008 at 9:56 AM, Viswa.TK <vk...@inautix.co.in>
> > wrote:
> >
> >>
> >> Actually i have configured using CXF/Spring...
> >>
> >>
> >>
> >> Benson Margulies-4 wrote:
> >> >
> >> > You will need to give us much more detail. How are you configuring
> CXF?
> >> >
> >> > On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK <vk...@inautix.co.in>
> >> > wrote:
> >> >
> >> >>
> >> >> Hi,
> >> >>
> >> >> I am Apache CXF for Webservice. I have an interface which returns a
> >> POJO.
> >> >> I
> >> >> have implemented CXF for this interface. But it is creating WSDL with
> >> the
> >> >> type of interface only. POJO types are ignored in the WSDL while
> >> creating
> >> >> on
> >> >> the fly. But correct WSDL is generated if i use any maven plugins.
> >> Could
> >> >> some tell me the reason for this?
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19858734.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19872139.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: POJO Types not creating in WSDL

Posted by "Viswa.TK" <vk...@inautix.co.in>.
I have created a implementation class which implements an interface with one
method. The method returns a POJO class and also it takes a POJO object as
parameter. i. e. it is configured as Code first.
I have given annotation in both implementation class and interface class as
given below

Implementation class
------------------------

@WebService(endpointInterface = "com.services.Myinterface",
targetNamespace="http://cxf.apache.org")
public class MyServices implements Myinterface {

   public DemoPOJO getResult(RequestInfo requestInfo)	throws Exception {
}

Interface class
-------------------------

@WebService
public interface Myinterface {
	public DemoPOJO getResult(@WebParam(name="requestInfo") RequestInfo
requestInfo) throws Exception;
}

spring beans.xml
--------------------------

	<jaxws:endpoint 
		  id="resultView" 
		  address="/resultView">	  
		  <jaxws:implementor>
		  	 <bean id="myServices" class="com.services.MyServices">
				<property name="aViewService" ref="aViewService" />
	    	</bean>
		  </jaxws:implementor>
	</jaxws:endpoint>


Using the above code and configuration, WSDL has been created. But WSDL does
not have the definition of the POJO's (DemoPOJO and RequestInfo). 




Benson Margulies-4 wrote:
> 
> But how? I am completely unable to visualize your problem from your
> description. AJX-WS or Simple? JAX-B or Aegis? Code first or WSDL-first?
> 
> On Tue, Oct 7, 2008 at 9:56 AM, Viswa.TK <vk...@inautix.co.in>
> wrote:
> 
>>
>> Actually i have configured using CXF/Spring...
>>
>>
>>
>> Benson Margulies-4 wrote:
>> >
>> > You will need to give us much more detail. How are you configuring CXF?
>> >
>> > On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK <vk...@inautix.co.in>
>> > wrote:
>> >
>> >>
>> >> Hi,
>> >>
>> >> I am Apache CXF for Webservice. I have an interface which returns a
>> POJO.
>> >> I
>> >> have implemented CXF for this interface. But it is creating WSDL with
>> the
>> >> type of interface only. POJO types are ignored in the WSDL while
>> creating
>> >> on
>> >> the fly. But correct WSDL is generated if i use any maven plugins.
>> Could
>> >> some tell me the reason for this?
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19858734.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19872139.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: POJO Types not creating in WSDL

Posted by Benson Margulies <bi...@gmail.com>.
But how? I am completely unable to visualize your problem from your
description. AJX-WS or Simple? JAX-B or Aegis? Code first or WSDL-first?

On Tue, Oct 7, 2008 at 9:56 AM, Viswa.TK <vk...@inautix.co.in> wrote:

>
> Actually i have configured using CXF/Spring...
>
>
>
> Benson Margulies-4 wrote:
> >
> > You will need to give us much more detail. How are you configuring CXF?
> >
> > On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK <vk...@inautix.co.in>
> > wrote:
> >
> >>
> >> Hi,
> >>
> >> I am Apache CXF for Webservice. I have an interface which returns a
> POJO.
> >> I
> >> have implemented CXF for this interface. But it is creating WSDL with
> the
> >> type of interface only. POJO types are ignored in the WSDL while
> creating
> >> on
> >> the fly. But correct WSDL is generated if i use any maven plugins. Could
> >> some tell me the reason for this?
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19858734.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: POJO Types not creating in WSDL

Posted by "Viswa.TK" <vk...@inautix.co.in>.
Actually i have configured using CXF/Spring...



Benson Margulies-4 wrote:
> 
> You will need to give us much more detail. How are you configuring CXF?
> 
> On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK <vk...@inautix.co.in>
> wrote:
> 
>>
>> Hi,
>>
>> I am Apache CXF for Webservice. I have an interface which returns a POJO.
>> I
>> have implemented CXF for this interface. But it is creating WSDL with the
>> type of interface only. POJO types are ignored in the WSDL while creating
>> on
>> the fly. But correct WSDL is generated if i use any maven plugins. Could
>> some tell me the reason for this?
>> --
>> View this message in context:
>> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19858734.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: POJO Types not creating in WSDL

Posted by Benson Margulies <bi...@gmail.com>.
You will need to give us much more detail. How are you configuring CXF?

On Tue, Oct 7, 2008 at 9:01 AM, Viswa.TK <vk...@inautix.co.in> wrote:

>
> Hi,
>
> I am Apache CXF for Webservice. I have an interface which returns a POJO. I
> have implemented CXF for this interface. But it is creating WSDL with the
> type of interface only. POJO types are ignored in the WSDL while creating
> on
> the fly. But correct WSDL is generated if i use any maven plugins. Could
> some tell me the reason for this?
> --
> View this message in context:
> http://www.nabble.com/POJO-Types-not-creating-in-WSDL-tp19857670p19857670.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>