You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by castlec <ca...@yahoo.com> on 2008/12/01 15:26:58 UTC

Customizing Generated Java

I would like to generate a test version of a web service using its WSDL. 
What I would like to do is to assign reasonable defaults inside of the
various data containers during the generation so that there is minimal data
setup to do after the code is generated.  I'm thinking of something along
the lines of getValue(xsdElementName) that is called for each field
generated.  Is this possible? If so, how would I go about doing it?  Is
there a better way to accomplish my goal?
 
Thanks in advance,
 
Chris
-- 
View this message in context: http://www.nabble.com/Customizing-Generated-Java-tp20772926p20772926.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Customizing Generated Java

Posted by Benson Margulies <bi...@gmail.com>.
I could imagine such a feature of the tooling. You could experiment
with a patch to the jaxws tooling for this purpose.

On Mon, Dec 1, 2008 at 9:26 AM, castlec <ca...@yahoo.com> wrote:
>
> I would like to generate a test version of a web service using its WSDL.
> What I would like to do is to assign reasonable defaults inside of the
> various data containers during the generation so that there is minimal data
> setup to do after the code is generated.  I'm thinking of something along
> the lines of getValue(xsdElementName) that is called for each field
> generated.  Is this possible? If so, how would I go about doing it?  Is
> there a better way to accomplish my goal?
>
> Thanks in advance,
>
> Chris
> --
> View this message in context: http://www.nabble.com/Customizing-Generated-Java-tp20772926p20772926.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Customizing Generated Java

Posted by castlec <ca...@yahoo.com>.
I got it.  Shortly after I sent the last post, I reread the description of
the command and double-checked the service impl and there it was.  Thanks
again for your help.

Chris
-- 
View this message in context: http://www.nabble.com/Customizing-Generated-Java-tp20772926p20781503.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Customizing Generated Java

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 01 December 2008 4:35:05 pm castlec wrote:
> dkulp wrote:
> > The JAXWS tooling (wsdl2java) does have a "plugin" thing that can provide
> > default values for various return things and params.   If you run:
> >
> > wsdl2java -all -defaultValues my.wsdl
>
> Thanks for the info.  I tried it out and the only evidence I have seen of
> its action is in the client main that is generated.  What I want to create
> is a default server response rather than a default request.  I am trying to
> create a way to mock a service from a wsdl as quickly as possible.  Have I
> missed something?  If not, do you know what part of the gen process I can
> alter to make this happen?

Depending on the flags you use, it may have generated an "Impl" for the 
service as well that would also use the defaultValues thing.   For example, 
if you use "-all" with a hello_world wsdl, there should be a GreeterImpl.java 
generated as well.      I think there is an "-impl" flag for just the impl.  
Not sure though.

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

Re: Customizing Generated Java

Posted by Andrew Clegg <an...@gmail.com>.
You might also find SoapUI useful for creating mock services from a  
WSDL -- see soapui.org .

Andrew.


On 1 Dec 2008, at 21:35, castlec <ca...@yahoo.com> wrote:

>
>
> dkulp wrote:
>>
>>
>> The JAXWS tooling (wsdl2java) does have a "plugin" thing that can  
>> provide
>> default values for various return things and params.   If you run:
>>
>> wsdl2java -all -defaultValues my.wsdl
>>
>>
>
> Thanks for the info.  I tried it out and the only evidence I have  
> seen of
> its action is in the client main that is generated.  What I want to  
> create
> is a default server response rather than a default request.  I am  
> trying to
> create a way to mock a service from a wsdl as quickly as possible.   
> Have I
> missed something?  If not, do you know what part of the gen process  
> I can
> alter to make this happen?
>
> Thanks,
>
> Chris
> -- 
> View this message in context: http://www.nabble.com/Customizing-Generated-Java-tp20772926p20781054.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Re: Customizing Generated Java

Posted by castlec <ca...@yahoo.com>.

dkulp wrote:
> 
> 
> The JAXWS tooling (wsdl2java) does have a "plugin" thing that can provide 
> default values for various return things and params.   If you run:
> 
> wsdl2java -all -defaultValues my.wsdl
> 
> 

Thanks for the info.  I tried it out and the only evidence I have seen of
its action is in the client main that is generated.  What I want to create
is a default server response rather than a default request.  I am trying to
create a way to mock a service from a wsdl as quickly as possible.  Have I
missed something?  If not, do you know what part of the gen process I can
alter to make this happen?

Thanks,

Chris
-- 
View this message in context: http://www.nabble.com/Customizing-Generated-Java-tp20772926p20781054.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Customizing Generated Java

Posted by Daniel Kulp <dk...@apache.org>.
The JAXWS tooling (wsdl2java) does have a "plugin" thing that can provide 
default values for various return things and params.   If you run:

wsdl2java -all -defaultValues my.wsdl

you'll see some random stuff set into the code.    The -defaultValues takes a 
param of the name of the class to use to provide the values.   The default is 
the RandomValueProvider.  You could write your own that does something more 
complete.

The interface to implement is:
http://svn.apache.org/repos/asf/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DefaultValueProvider.java

The random value thing is at:
http://svn.apache.org/repos/asf/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/RandomValueProvider.java

Dan



On Monday 01 December 2008 9:26:58 am castlec wrote:
> I would like to generate a test version of a web service using its WSDL.
> What I would like to do is to assign reasonable defaults inside of the
> various data containers during the generation so that there is minimal data
> setup to do after the code is generated.  I'm thinking of something along
> the lines of getValue(xsdElementName) that is called for each field
> generated.  Is this possible? If so, how would I go about doing it?  Is
> there a better way to accomplish my goal?
>
> Thanks in advance,
>
> Chris



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