Since Apache CXF or any other web service creates POJOs which are not
directly usable by GWT, we have taken extra pains to replicate the same
POJOs as GWT side POJOs. When servlet makes a call to the web service,
whatever objects we get back are anaylysed and then their 'copy' is made
into GWT side POJOs. Its tedious, but hey it works and scales too.

Thank you,
Sunit Katkar




On Fri, Apr 22, 2011 at 2:01 PM, Armishev, Sergey <[email protected]>wrote:

> I did this GWT-RPC-WSDL integration and it works fine. Maybe not very much
> efficient but it works and I made quicly what I needed. I used wscompile to
> generate POJO java classes from WSDL. That are classes that Web server user
> for web services communication. They are server side classes. Then I copied
> server classes to client package and manually editted generated POJO classes
> to be  GWT RPC compatible. Yes, it is duplication and bad and I would like
> to have the same classes for both sides but… don’t have time to develop full
> solution  Then ,Cxf knows nothing about GWT so even POJO classes has
> references on unsupported Java classes such as Calendar (see below example).
> I manually editted those file to be GWT RPC compatible. Not a big deal Then
> I add  “ implements java.io.Serializable”  implementation to class
> definition. And then in run time translate server side classes to client and
> back.
>
> Below is POJO file generated by cxf and corresponding class which is
> GWT-RPC compatible. See Calendar class that is not supported.
>
>
>
> Let me know if you need more help
>
> -Sergey
>
>
>
> // This class was generated by the JAXRPC SI, do not edit.
>
> // Contents subject to change without notice.
>
> // JAX-RPC Standard Implementation (1.1.3, build R1)
>
> // Generated source version: 1.1.3
>
>
>
> package com.idirect.webnms.*server*.toolkit;
>
>
>
>
>
> public class NmsErrorCondition extends 
> com.idirect.webnms.*server*.toolkit.NmsObject
> {
>
>     *protected java.util.Calendar timeStamp;*
>
>     protected com.idirect.webnms.client.toolkit.NmsErrorSeverity
> errorSeverity;
>
>     protected java.lang.String errorMessage;
>
>
>
>     public NmsErrorCondition() {
>
>     }
>
>
>
>     public NmsErrorCondition(int objectType, boolean initialized,
> java.util.Calendar timeStamp,
> com.idirect.webnms.client.toolkit.NmsErrorSeverity errorSeverity,
> java.lang.String errorMessage) {
>
>         this.objectType = objectType;
>
>         this.initialized = initialized;
>
>         this.timeStamp = timeStamp;
>
>         this.errorSeverity = errorSeverity;
>
>         this.errorMessage = errorMessage;
>
>     }
>
>
>
> *    public java.util.Calendar getTimeStamp() {*
>
> *        return timeStamp;*
>
> *    }*
>
>
>
>     public void setTimeStamp(java.util.Calendar timeStamp) {
>
>         this.timeStamp = timeStamp;
>
>     }
>
>
>
>     public com.idirect.webnms.client.toolkit.NmsErrorSeverity
> getErrorSeverity() {
>
>         return errorSeverity;
>
>     }
>
>
>
>     public void
> setErrorSeverity(com.idirect.webnms.client.toolkit.NmsErrorSeverity
> errorSeverity) {
>
>         this.errorSeverity = errorSeverity;
>
>     }
>
>
>
>     public java.lang.String getErrorMessage() {
>
>         return errorMessage;
>
>     }
>
>
>
>     public void setErrorMessage(java.lang.String errorMessage) {
>
>         this.errorMessage = errorMessage;
>
>     }
>
> }
>
>
>
> And you translate it to
>
> // This class was generated by the JAXRPC SI, do not edit.
>
> // Contents subject to change without notice.
>
> // JAX-RPC Standard Implementation (1.1.3, build R1)
>
> // Generated source version: 1.1.3
>
>
>
> package com.idirect.webnms.*client*.toolkit;
>
>
>
>
>
> public class NmsErrorCondition extends 
> com.idirect.webnms.*client*.toolkit.NmsObject
> {
>
>     *protected java.util.Date timeStamp;*
>
>     protected com.idirect.webnms.client.toolkit.NmsErrorSeverity
> errorSeverity;
>
>     protected java.lang.String errorMessage;
>
>     public NmsErrorCondition() {
>
>     }
>
>
>
>     public NmsErrorCondition(int objectType, boolean initialized,
> java.util.Date timeStamp, com.idirect.webnms.client.toolkit.NmsErrorSeverity
> errorSeverity, java.lang.String errorMessage) {
>
>         this.objectType = objectType;
>
>         this.initialized = initialized;
>
>         this.timeStamp = timeStamp;
>
>         this.errorSeverity = errorSeverity;
>
>         this.errorMessage = errorMessage;
>
>     }
>
>
>
> *    public java.util.Date getTimeStamp() {*
>
> *        return timeStamp;*
>
> *    }*
>
>
>
>     public void setTimeStamp(java.util.Date timeStamp) {
>
>         this.timeStamp = timeStamp;
>
>     }
>
>
>
>     public com.idirect.webnms.client.toolkit.NmsErrorSeverity
> getErrorSeverity() {
>
>         return errorSeverity;
>
>     }
>
>
>
>     public void
> setErrorSeverity(com.idirect.webnms.client.toolkit.NmsErrorSeverity
> errorSeverity) {
>
>         this.errorSeverity = errorSeverity;
>
>     }
>
>
>
>     public java.lang.String getErrorMessage() {
>
>         return errorMessage;
>
>     }
>
>
>
>     public void setErrorMessage(java.lang.String errorMessage) {
>
>         this.errorMessage = errorMessage;
>
>     }
>
>
>
> }
>
>
>
> And then you need  Calendar – Date translation
>
>                 public static java.util.Date get(java.util.Calendar in) {
>
>                                 return in.getTime();
>
>                 }
>
>
>
>                 public static java.util.Calendar get(java.util.Date in) {
>
>                                 Calendar calendar =
> java.util.Calendar.getInstance();
>
>                                 calendar.setTime(in);
>
>                                 return calendar;
>
>                 }
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Sunit Katkar
> *Sent:* Friday, April 22, 2011 11:14 AM
> *To:* [email protected]
> *Subject:* Re: GWT RPC - WebServiceClient
>
>
>
> We have exact same situation and it all works.
>
>
>
> We use apache cxf as the communication between the GWT servlets and the API
> layer on another server.
>
> When the WSDLs are created for the apache cxf, we generate a client side
> jar and include it in the GWT project. This allows us access to the java
> objects which are created on API layer side, then transmitted as XML and
> finally reconstructed on GWT (UI) server side.
>
>
>
> Basically the idea is similar to generating a Java client for using your
> web service and then use it in your GWT servlet.
>
>
>
> I would have shared code with you but cannot as its company code and
> company policy, etc.
>
>
> Thank you,
>
> Sunit Katkar
>
>
>
> On Wed, Apr 20, 2011 at 12:17 AM, Stijn Bienkens <
> [email protected]> wrote:
>
> Hello
>
> We are currently looking to optimize some of our GWT projects but we
> ran into a few issues.
>
> Most if not all of our data is coming from an OSGI backend.
> Communication between the GWT client - GWT RPC - OSGI backend is far
> from optimal as we have to write a lot of boiler plate code. To
> optimize this we were thinking of including one ( or multiple)
> webservices in our OSGI backend using Apache CXF.
>
> On the GWT RPC side we implemented a webservice client using Apache
> CXF 2 as well. However the real challenge we are facing is how to use
> the CXF generated objects for communication between GWT client and GWT
> RPC.
>
> I've came across several posts claiming this was perfectly possible
> but so far we haven't been successful.
>
> The Apache CXF generated classes have references to JAXBElement, when
> compiling this results in: "No source code is available for type
> javax.xml.bind.JAXBElement<T>;"
> Using the <super-source> tag we provided the source for JAXBElement,
> however this results in more of the same issues for:
> javax.xml.namespace.Qname, java.io.ObjectInputStream,
> java.lang.ClassNotFoundException, ...
>
> Is there anyway to accomplish this or another path we can follow?
>
> Thank you in advance
> Stijn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
> _____________________________________________________
> This electronic message and any files transmitted with it contains
> information from iDirect, which may be privileged, proprietary
> and/or confidential. It is intended solely for the use of the individual
> or entity to whom they are addressed. If you are not the original
> recipient or the person responsible for delivering the email to the
> intended recipient, be advised that you have received this email
> in error, and that any use, dissemination, forwarding, printing, or
> copying of this email is strictly prohibited. If you received this email
> in error, please delete it and immediately notify the sender.
> _____________________________________________________
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to