« Return to Thread: How to isolate application from generated stubs

Re: How to isolate application from generated stubs

by metro-3 :: Rate this Message:

Reply to Author | View in Thread

I believe we have done something similar to what you are talking about. If I understand correctly, here is a suggested way.  (BTW - you still need some of the generated classes, for the port, service, etc - but you can eliminate the equivalent POJOs that make up your domain objects)

1) Your domain [b]POJOs[/b] that you wish to share between the front and backend would be annotated something like this:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Vendor", namespace = "http://dvo.services.myapp.acme.com/")
public class Vendor implements Serializable {

...
...
}



This insures the classes keep their package naming.

2) The resulting .class files should then be packaged into a separate "shared objects" JAR file that will be bundled now into your web service WAR file (our Ant script does not include these in the WEB-INF/classes during WAR creation), instead it adds the "shared objects" JAR to /WEB-INF/lib....AND then.....the same JAR would then be used by the front end app instead of the [i]generated[/i] equivalents that will be created by wsimport usage when you are building the client (the consumer).

3) In the case of building the front end application, we have the Ant script on that side exclude the "generated" POJO equivalents. You wind up w/ 2 jars being used by the front end app - one is the "shared objects" JAR - the exact same one used by the back end (web service) and the other is simply the JAR containing the "generated" stubs (the service interface, the service itself with the methods to return the Port and the constructor for the service instance, etc)   for the service (MINUS the generated [b]POJO[/b] classes - wsimport still generates them, we just discard them).

Hope this helps.  One big caveat:  this idea works as long as you "own" both ends of the wire.  Otherwise, an "external" consumer would not rely on some sort of "generated/provided" artifact required to interact w/ the deployed service - they'd be using the WSDL and building whatever client "stub" was required (say .NET, or even Java) that works in THEIR environment with their tools.
[Message sent by forum member 'mcs130' (mcs130)]

http://forums.java.net/jive/thread.jspa?messageID=353826

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: How to isolate application from generated stubs