AXIS: WSDL2Java generated javabean is different

I have a javabean in the following format:

public MyBean{

private String name ;

public MyBean(){

}

public MyBean(String name){

this.name = name ;

}

public String getName(){

return name ;

}

public void setName(String name){

this.name = name ;

}

}

This bean is used by my axis service. It can be created by the server and sent as a return type to my service call and used fine by the client.

I then decided to write a service that took this bean type as an input parameter. Ran Java2WSDL to generate the WSDL, then ran WSDL2Java to get the required client side code. I wrote the client and the compile failed when I attempted to use the argument based constructor. Looking at the generated code I noticed that the generated class for the bean didn't have such a constructor and only had the default constructor.

I know that the bean must have a default constructor to satisfy the requirements for a javabean, but I don't know why the other constructor is missing from the generated code.

Is this a bug or because an argument based constructor isn't allowed in a javabean?

Thanks in advance

Chris

[1232 byte] By [cjparra] at [2007-11-26 16:04:19]
# 1
I should expand on my bean:It does have other attributes and a constructor does exist that sets every attribute, but not the one argument constructor I specified when I wrote it on the server (ie I can't construct the bean with just a name).Chris
cjparra at 2007-7-8 22:26:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Hello Chris,

I am also facing the same problem. The Javabean constructed after I ran my <axis-wsdl2java> is different. In my javabean I have a multi-argument constructor apart from the default constructor, and every time I generated the java bindings, the order in the multi-argument constructor changes.

How to fix this problem of constantly changing the constructor. I need to use this multi-argument constructor in my other Java classes.

Anybody please let us know how to ensure that the constructors generated by the <axis-wsdl2java> task will be constant all the time with one-to-one matching of the javabean I provide.

Regards

Shekar

ShekarSDNa at 2007-7-8 22:26:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...