Creating and consuming Web services JAX-WS / Netbeans

T

TwelveEighty

I like to know if there is an easy way to eliminate the duplicate
"overhead" classes created with JAX-WS / Netbeans (not sure who's the
culprit) when I create and consume a Web service across two projects,
sharing the same Java bean:

Let's say I have three Java projects, 1) a simple "library" with
mostly utility Java Beans, 2) a Web Service server project and 3) a
Web Service client project.

Project 1 contains a plain old Java Bean called library.MyBean:

package library;

public class MyBean {
private String foo;

public MyBean() {}

public String getFoo() {
return foo;
}

public void setFoo(String foo) {
this.foo = foo;
}
}

Project 2 uses project1.jar and exposes a Web Service "SomeWS" that
returns library.MyBean:

@WebService()
public class SomeWS {

@WebMethod(operationName = "returnMyBean")
public library.MyBean returnMyBean() {}
}

Here's the tricky part: Project 3 uses project1.jar but also consumes
the "SomeWS"; in doing so, the Web Service importer starts with the
WSDL file and re-creates the MyBean definition, in a package of choice
prompted by NetBeans, for example: ws.imported.MyBean.

So now I end up with two, perfectly symmetrical definitions of MyBean,
each in their own package (library.MyBean and ws.imported.MyBean).

Is there a way to "fool" the importer to use the original definition
of library.MyBean instead of recreating it under ws.imported.MyBean?

I understand that the @XmlAccessorType and @XmlType annotations need
to be present for the JAX-WS to work on the client side. Could I
simply add these annotations to the original library.MyBean class? Or
would this still recreate the ws.imported.MyBean?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top