WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Chris C.
The examples make the consumption of a SOAP-based web service seem so easy, but I've been having nothing but grief.  It's been 4 days and I can't even get a simple, stupid "hello world" example working!

It's not the code that's causing me grief -- it's the configuration (ironically, what grails is supposed to help you avoid.)

I've tried various combinations of Grails 1.2.3 and 1.3.3.  With and without Maven (although the project architect is dead-set that we have to use maven).

I once got it to read a Celsius/Fahrenheit service at w3c, but when I tried to read a service I'd written (Grails, axis2) it didn't return a string but instead created a HelloWorldResponce class that I couldn't do anything with.

Mostly I'm running into exceptions that seem to be caused by jar-file incompatibilities.  Getting pretty frustrated and pretty much ready to brand grails as "a horrible fit for SOAP-based web services" even though the samples/blogs/tutorials all make it seem easy.

If anyone can post a pom.xml or some hints on configuration (jar combos) that they know work, I'd be eternally grateful.

Also, as an aside, is there a difference between the ws-client grails plug-in and the GroovyWS jar?  Is one recommended over the other?  Maven doesn't seem to be aware of the ws-client grails plug-in, but it does know about the GroovyWS jar.  I had more luck with the plug-in though, except for compiling code in Eclipse which can't find the library for the import statment.
Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

marcopas
I am also wondering if Grails is suitable for consuming and serving
SOAP based services, i have not yet gotten to the point when to try
them. So i am closely following this thread.

2010/7/16 Chris C. <[hidden email]>:

>
> The examples make the consumption of a SOAP-based web service seem so easy,
> but I've been having nothing but grief.  It's been 4 days and I can't even
> get a simple, stupid "hello world" example working!
>
> It's not the code that's causing me grief -- it's the configuration
> (ironically, what grails is supposed to help you avoid.)
>
> I've tried various combinations of Grails 1.2.3 and 1.3.3.  With and without
> Maven (although the project architect is dead-set that we have to use
> maven).
>
> I once got it to read a Celsius/Fahrenheit service at w3c, but when I tried
> to read a service I'd written (Grails, axis2) it didn't return a string but
> instead created a HelloWorldResponce class that I couldn't do anything with.
>
> Mostly I'm running into exceptions that seem to be caused by jar-file
> incompatibilities.  Getting pretty frustrated and pretty much ready to brand
> grails as "a horrible fit for SOAP-based web services" even though the
> samples/blogs/tutorials all make it seem easy.
>
> If anyone can post a pom.xml or some hints on configuration (jar combos)
> that they know work, I'd be eternally grateful.
>
> Also, as an aside, is there a difference between the ws-client grails
> plug-in and the GroovyWS jar?  Is one recommended over the other?  Maven
> doesn't seem to be aware of the ws-client grails plug-in, but it does know
> about the GroovyWS jar.  I had more luck with the plug-in though, except for
> compiling code in Eclipse which can't find the library for the import
> statment.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2291376.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Sébastien Launay-2
In reply to this post by Chris C.
I don't think that these issues are related to Grails core.

In your case, WS consumption is provided by the ws-client Grails plug-in
which exposes the WSClient class of the GroovyWS module [1].

I agree that there is a step between simple service like Celsius/Fahrenheit
and your service (maybe all other services ;)). Indeed, this is because the
request and response objects depends heavily on the WSDL. In the
w3schools service example the response is a simple type (i.e. tns:string).

But in your case Axis2 may produce a complex response containing only
one property of type String. Then, it's getting harder and you need to be
familiar with JAXB [2]. Indeed, GroovyWS uses Apache CXF [3] for
creating and compiling JAXB beans on the fly (WSClient#initialize()).

JAXB provide a convention for creating these beans based on the WSDL
and you have IMHO two solutions to access interesting data:
- debugging code to retrieve response object properties like:
def response = wsClient.operation()
println response.properties
- analyze the WSDL to determine the generated properties

I found GroovyWS very productive for consuming SOAP WS especially
because there is no need to first generate java objects from the WSDL
and because it is not too tied to the WSDL model (adding/removing a
property later in the WSDL will not affect the code if these properties
are not used I think).
On the other hand, it is difficult to know what you are manipulating
especially for creating request, you need to know the package computed
from the namespace (can be found in the logs) and create each sub
object by instantiating the right class (that's also the case in Java but
you will have IDE completion) with potential ClassLoader issues [4].

So, to sum up your issue of HelloWorldResponse class might come
from Axis2 generated WSDL. But, you will still have the same behavior
for any complex objects.

For the Eclipse compiling issue, I had the same issue with STS when
upgrading Grails from 1.2.2 to 1.3.2. Upgrading to the latest STS
milestone provides the Eclipse classpath with plugin's dependencies
and allows proper compilation like before.

[1] http://groovy.codehaus.org/GroovyWS
[2] http://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding
[3] http://cxf.apache.org/
[4] http://jira.codehaus.org/browse/GMOD-85

--
Sébastien Launay

2010/7/16 Chris C. <[hidden email]>

The examples make the consumption of a SOAP-based web service seem so easy,
but I've been having nothing but grief.  It's been 4 days and I can't even
get a simple, stupid "hello world" example working!

It's not the code that's causing me grief -- it's the configuration
(ironically, what grails is supposed to help you avoid.)

I've tried various combinations of Grails 1.2.3 and 1.3.3.  With and without
Maven (although the project architect is dead-set that we have to use
maven).

I once got it to read a Celsius/Fahrenheit service at w3c, but when I tried
to read a service I'd written (Grails, axis2) it didn't return a string but
instead created a HelloWorldResponce class that I couldn't do anything with.

Mostly I'm running into exceptions that seem to be caused by jar-file
incompatibilities.  Getting pretty frustrated and pretty much ready to brand
grails as "a horrible fit for SOAP-based web services" even though the
samples/blogs/tutorials all make it seem easy.

If anyone can post a pom.xml or some hints on configuration (jar combos)
that they know work, I'd be eternally grateful.

Also, as an aside, is there a difference between the ws-client grails
plug-in and the GroovyWS jar?  Is one recommended over the other?  Maven
doesn't seem to be aware of the ws-client grails plug-in, but it does know
about the GroovyWS jar.  I had more luck with the plug-in though, except for
compiling code in Eclipse which can't find the library for the import
statment.
Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

rlovtangen
In reply to this post by marcopas
I have no problems consuming SOAP based services with GroovyWS.
I first did this from a plain jar, which was included in a plain war.
Then later I changed the war to using Grails, still doing the SOAP call in the jar (i.e. I'm not using any Grails plugin for this)

Because Java 6 includes a lot of XML-stuff you in Java 1.5 needed external dependencies for, I have quite many excludes in my pom. I also excluded some other dependencies that caused problems.

Here's the groovyws related part of my pom.xml:

                <dependency>
                        <groupId>org.codehaus.groovy.modules</groupId>
                        <artifactId>groovyws</artifactId>
                        <version>0.5.2</version>
                        <exclusions>
                                <exclusion>
                                        <groupId>org.apache.geronimo.specs</groupId>
                                        <artifactId>geronimo-servlet_2.5_spec</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>org.mortbay.jetty</groupId>
                                        <artifactId>servlet-api</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>com.sun.xml.bind</groupId>
                                        <artifactId>jaxb-xjc</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>com.sun.xml.bind</groupId>
                                        <artifactId>jaxb-impl</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>xml-apis</groupId>
                                        <artifactId>xml-apis</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>com.sun.xml.messaging.saaj</groupId>
                                        <artifactId>saaj-impl</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>


And I have this in dependencyManagement to exclude some transitive dependencies from CXF:

        <dependencyManagement>
                <dependencies>
                        <dependency>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-bundle</artifactId>
                                <version>2.2.7</version>
                                <exclusions>
                                        <exclusion>
                                                <groupId>org.slf4j</groupId>
                                                <artifactId>slf4j-jdk14</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>xerces</groupId>
                                                <artifactId>xmlParserAPIs</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>javax.xml.bind</groupId>
                                                <artifactId>jaxb-api</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>javax.xml.soap</groupId>
                                                <artifactId>saaj-api</artifactId>
                                        </exclusion>
                                        <!--<exclusion>-->
                                                <!--<groupId>xerces</groupId>-->
                                                <!--<artifactId>xercesImpl</artifactId>-->
                                        <!--</exclusion>-->
                                        <exclusion>
                                                <groupId>org.apache.xmlbeans</groupId>
                                                <artifactId>xmlbeans</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>jaxen</groupId>
                                                <artifactId>jaxen</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>org.apache.geronimo.specs</groupId>
                                                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
                                        </exclusion>
                                </exclusions>
                        </dependency>

                </dependencies>
        </dependencyManagement>


Ronny


On Jul 16, 2010, at 4:35 PM, Marco Pas wrote:

> I am also wondering if Grails is suitable for consuming and serving
> SOAP based services, i have not yet gotten to the point when to try
> them. So i am closely following this thread.
>
> 2010/7/16 Chris C. <[hidden email]>:
>>
>> The examples make the consumption of a SOAP-based web service seem so easy,
>> but I've been having nothing but grief.  It's been 4 days and I can't even
>> get a simple, stupid "hello world" example working!
>>
>> It's not the code that's causing me grief -- it's the configuration
>> (ironically, what grails is supposed to help you avoid.)
>>
>> I've tried various combinations of Grails 1.2.3 and 1.3.3.  With and without
>> Maven (although the project architect is dead-set that we have to use
>> maven).
>>
>> I once got it to read a Celsius/Fahrenheit service at w3c, but when I tried
>> to read a service I'd written (Grails, axis2) it didn't return a string but
>> instead created a HelloWorldResponce class that I couldn't do anything with.
>>
>> Mostly I'm running into exceptions that seem to be caused by jar-file
>> incompatibilities.  Getting pretty frustrated and pretty much ready to brand
>> grails as "a horrible fit for SOAP-based web services" even though the
>> samples/blogs/tutorials all make it seem easy.
>>
>> If anyone can post a pom.xml or some hints on configuration (jar combos)
>> that they know work, I'd be eternally grateful.
>>
>> Also, as an aside, is there a difference between the ws-client grails
>> plug-in and the GroovyWS jar?  Is one recommended over the other?  Maven
>> doesn't seem to be aware of the ws-client grails plug-in, but it does know
>> about the GroovyWS jar.  I had more luck with the plug-in though, except for
>> compiling code in Eclipse which can't find the library for the import
>> statment.
>> --
>> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2291376.html
>> Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Chris C.
Close, but no cigar...  :(

To recap: I'm using Maven2 with Grails 1.3.2.  I added the GroovyWS library via Maven and then updated my pom.xml with the values from the previous post.  I'm still getting exceptions.

If I add "pom true" to the dependencies section of my BuildConfig.groovy file, then I get the following when I try to compile or run (using either mvn compile or grails compile):

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to start Grails

Embedded error: java.lang.reflect.InvocationTargetException
loader constraint violation: when resolving overridden method "org.apache.xerces
.jaxp.SAXParserImpl.getXMLReader()Lorg/xml/sax/XMLReader;" the class loader (ins
tance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current
 class, org/apache/xerces/jaxp/SAXParserImpl, and its superclass loader (instanc
e of <bootloader>), have different Class objects for the type org/xml/sax/XMLRea
der used in the signature

If I take out the "pom true" then I still get the above error from Maven, but the grails compile complains that it can't find class WSClient.

It'd be really nice if there was a complete sample of consuming SOAP web services from a grails app that is integrated with maven2; however, I kind of get the feeling that the grails community is anti-maven and anti-SOAP/pro-REST.

I'm hapy for the people who have gotten SOAP to work with Grails, but for me... it's just been one huge nightmare.  I haven't given up yet, but I'm darn close.

Thanks to the guys who have tried to help.
Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

rlovtangen
If you're using an IDE you can use the 'open class' functionality to discover multiple implementations of the same class in your applications classpath.
In IntelliJ this is "Go To" -> "Class" (cmd-O on mac, ctrl-N on win/linux I think). In the dialog, write XMLReader and see what implementations are in your path. You should only have one, but I think you may have two or more.
In Eclipse its "open type" I think.
As long as your IDE use maven for figuring out dependencies, this is a nice way for figuring out stuff like this.

Ronny

On Jul 19, 2010, at 5:28 PM, Chris C. wrote:

>
> Close, but no cigar...  :(
>
> To recap: I'm using Maven2 with Grails 1.3.2.  I added the GroovyWS library
> via Maven and then updated my pom.xml with the values from the previous
> post.  I'm still getting exceptions.
>
> If I add "pom true" to the dependencies section of my BuildConfig.groovy
> file, then I get the following when I try to compile or run (using either
> mvn compile or grails compile):
>
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Unable to start Grails
>
> Embedded error: java.lang.reflect.InvocationTargetException
> loader constraint violation: when resolving overridden method
> "org.apache.xerces
> .jaxp.SAXParserImpl.getXMLReader()Lorg/xml/sax/XMLReader;" the class loader
> (ins
> tance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the
> current
> class, org/apache/xerces/jaxp/SAXParserImpl, and its superclass loader
> (instanc
> e of <bootloader>), have different Class objects for the type
> org/xml/sax/XMLRea
> der used in the signature
>
> If I take out the "pom true" then I still get the above error from Maven,
> but the grails compile complains that it can't find class WSClient.
>
> It'd be really nice if there was a complete sample of consuming SOAP web
> services from a grails app that is integrated with maven2; however, I kind
> of get the feeling that the grails community is anti-maven and
> anti-SOAP/pro-REST.
>
> I'm hapy for the people who have gotten SOAP to work with Grails, but for
> me... it's just been one huge nightmare.  I haven't given up yet, but I'm
> darn close.
>
> Thanks to the guys who have tried to help.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2294189.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Chris C.
In reply to this post by Chris C.
Gotten it to compile -- so some progress.

I had to copy the xerces xmlParserAPIs exclusion from the Dependancy Manager to also be an exclusion on the groovyws, but doing so got things to compile without error.  Strange.  (Have to admit that I'm brand new to maven -- in addition to grails and web services, perfect storm, eh? -- so I'm not sure what the significance of the Dependancy Management section is.  I'll read up on it later.)

Unfortuantely, when I run my application, it looks like there may be too much getting excluded as I run into the following exception:

Error 500: Executing action [list] of controller [ca.teranet.las.ConsumewsController] caused exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in URL [jar:file:/C:/Documents%20and%20Settings/cclark01/.m2/repository/org/apache/cxf/cxf-bundle/2.2.7/cxf-bundle-2.2.7.jar!/META-INF/cxf/cxf.fixml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found - with linked exception: [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]

Interestingly, the references jar "cxf-bundle-2.2.7.jar" is the one that the Dependency Management section is excluding things from.  At least I know where to start looking.

BTW, posting this not because I expect anyone to do my debugging for me, but mostly to document what I've been going through in case anyone else has as much trouble as I have.  That being said, I won't frown on any help/advice. :)  Thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

rlovtangen
mvn dependency:tree is a nice command to work out dependency issues.

Ronny

On Jul 19, 2010, at 6:11 PM, Chris C. wrote:

>
> Gotten it to compile -- so some progress.
>
> I had to copy the xerces xmlParserAPIs exclusion from the Dependancy Manager
> to also be an exclusion on the groovyws, but doing so got things to compile
> without error.  Strange.  (Have to admit that I'm brand new to maven -- in
> addition to grails and web services, perfect storm, eh? -- so I'm not sure
> what the significance of the Dependancy Management section is.  I'll read up
> on it later.)
>
> Unfortuantely, when I run my application, it looks like there may be too
> much getting excluded as I run into the following exception:
>
> Error 500: Executing action [list] of controller
> [ca.teranet.las.ConsumewsController] caused exception:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.cxf.wsdl.WSDLManager' defined in URL
> [jar:file:/C:/Documents%20and%20Settings/cclark01/.m2/repository/org/apache/cxf/cxf-bundle/2.2.7/cxf-bundle-2.2.7.jar!/META-INF/cxf/cxf.fixml]:
> Instantiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
> exception; nested exception is java.lang.RuntimeException:
> javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory
> not found - with linked exception: [java.lang.ClassNotFoundException:
> com.sun.xml.bind.v2.ContextFactory]
>
> Interestingly, the references jar "cxf-bundle-2.2.7.jar" is the one that the
> Dependency Management section is excluding things from.  At least I know
> where to start looking.
>
> BTW, posting this not because I expect anyone to do my debugging for me, but
> mostly to document what I've been going through in case anyone else has as
> much trouble as I have.  That being said, I won't frown on any help/advice.
> :)  Thanks again.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2294263.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Jonathan Stott-5
We have just had to implement a SOAP-based web service server and
client. We used the Maven dependency resolution to get around this,
but the biggest deal was setting the excludes so that it compiled!

In our server's BuildConfig.groovy we have:

plugins {
    runtime("org.grails.plugins:cxf:0.5.1") {
        excludes 'jaxen'
        excludes 'xmlbeans'
    }
}

And in the client's BuildConfig.groovy:

dependencies {
    runtime('org.codehaus.groovy.modules:groovyws:0.5.2') {
        excludes 'jaxen'
        excludes 'xmlbeans'
        excludes 'xalan'
        excludes 'xml-apis'
    }
}

Job done!

Jonathan



On 19 July 2010 19:09, Ronny Løvtangen <[hidden email]> wrote:

> mvn dependency:tree is a nice command to work out dependency issues.
>
> Ronny
>
> On Jul 19, 2010, at 6:11 PM, Chris C. wrote:
>
>>
>> Gotten it to compile -- so some progress.
>>
>> I had to copy the xerces xmlParserAPIs exclusion from the Dependancy Manager
>> to also be an exclusion on the groovyws, but doing so got things to compile
>> without error.  Strange.  (Have to admit that I'm brand new to maven -- in
>> addition to grails and web services, perfect storm, eh? -- so I'm not sure
>> what the significance of the Dependancy Management section is.  I'll read up
>> on it later.)
>>
>> Unfortuantely, when I run my application, it looks like there may be too
>> much getting excluded as I run into the following exception:
>>
>> Error 500: Executing action [list] of controller
>> [ca.teranet.las.ConsumewsController] caused exception:
>> org.springframework.beans.factory.BeanCreationException: Error creating bean
>> with name 'org.apache.cxf.wsdl.WSDLManager' defined in URL
>> [jar:file:/C:/Documents%20and%20Settings/cclark01/.m2/repository/org/apache/cxf/cxf-bundle/2.2.7/cxf-bundle-2.2.7.jar!/META-INF/cxf/cxf.fixml]:
>> Instantiation of bean failed; nested exception is
>> org.springframework.beans.BeanInstantiationException: Could not instantiate
>> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
>> exception; nested exception is java.lang.RuntimeException:
>> javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory
>> not found - with linked exception: [java.lang.ClassNotFoundException:
>> com.sun.xml.bind.v2.ContextFactory]
>>
>> Interestingly, the references jar "cxf-bundle-2.2.7.jar" is the one that the
>> Dependency Management section is excluding things from.  At least I know
>> where to start looking.
>>
>> BTW, posting this not because I expect anyone to do my debugging for me, but
>> mostly to document what I've been going through in case anyone else has as
>> much trouble as I have.  That being said, I won't frown on any help/advice.
>> :)  Thanks again.
>> --
>> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2294263.html
>> Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Chris C.
This is beyond frustrating now...  I've got a deadline of tomorrow morning to figure this out, or we ditch grails completely.  I tried adding the dependencies {} bit to the BuildConfig.groovy of a clean project, but it made no difference.  It still gets a compile error.

I really appreciate all of the help being offered, unfortunately, bits and pieces just aren't cutting it for me.  I've never felt this stupid in my life before!  Does anyone have a "basic Grails + Maven + SOAP consuming application skeleton for Dummies" with every include, dependancy etc. spelled out?

Jonathon, did you add groovyws as a maven dependency?  What version of the JDK are you using?  What version of Grails?  or Maven?  Did you also have to do the pom dependency entries specified in a previous reply?  What about the "pom true" setting in the BuildConfig.groovy -- do you use that?

There's enough people posting that this is possible that I believe it.  However, I've spent FIVE DAYS trying to get this thing to work and it's just one issue after another.  I don't have the patience to figure out all of the dependencies and my architect figures that if there are that many dependancy issues, it's probably not suitable for anything close to a mission critical application anyway.

Thanks again for the replies, but short of a step-by-step guide, I think I'm done here.
Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

rlovtangen
Just a quick note.
I think pom true is just to be able to run commands through grails command line. Rather than using the maven plugin i.e. 'grails run-app' rather than 'mvn grails:run-app'.
 
Ronny

On Jul 19, 2010, at 9:50 PM, Chris C. wrote:

>
> This is beyond frustrating now...  I've got a deadline of tomorrow morning to
> figure this out, or we ditch grails completely.  I tried adding the
> dependencies {} bit to the BuildConfig.groovy of a clean project, but it
> made no difference.  It still gets a compile error.
>
> I really appreciate all of the help being offered, unfortunately, bits and
> pieces just aren't cutting it for me.  I've never felt this stupid in my
> life before!  Does anyone have a "basic Grails + Maven + SOAP consuming
> application skeleton for Dummies" with every include, dependancy etc.
> spelled out?
>
> Jonathon, did you add groovyws as a maven dependency?  What version of the
> JDK are you using?  What version of Grails?  or Maven?  Did you also have to
> do the pom dependency entries specified in a previous reply?  What about the
> "pom true" setting in the BuildConfig.groovy -- do you use that?
>
> There's enough people posting that this is possible that I believe it.
> However, I've spent FIVE DAYS trying to get this thing to work and it's just
> one issue after another.  I don't have the patience to figure out all of the
> dependencies and my architect figures that if there are that many dependancy
> issues, it's probably not suitable for anything close to a mission critical
> application anyway.
>
> Thanks again for the replies, but short of a step-by-step guide, I think I'm
> done here.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2294510.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Jonathan Stott-5
In reply to this post by Chris C.
Chris,

I totally agree, it took ages to get it to work. The documentation out
there on the web is quite frankly awful - if I have time I would write
better docs but I am so overwhelmed with work at the moment that won't
happen any time soon.

We are using J2SE 6.0 and have tested our SOAP stuff in Grails 1.3.1
and 1.3.2. I didn't do anything at all with poms or set pom true.

When you add the groovyws dependencies on the client it will download
shedloads of jars. If it didn't do this, then you might have missed
out uncommenting the mavenRepos. We have uncommented the mavenCetral
and Codehaus repos:

    mavenCentral()
    mavenRepo "http://repository.codehaus.org"

Client code is pretty much just this:

import groovyx.net.ws.WSClient
...
WSClient wsc = new
WSClient("http://www.example.com/xxx/services/xxx?wsdl",
this.class.classLoader)
wsc.initialize()
def ret = wsClient().getSomething(arg)

Then on the server I just have:

class XxxService {
    static expose = ['cxf']
    ...
    XxxDto getSomething(arg) {
        return new XxxDto(val: arg * 2)
    }
}

And then used the XxxDto to transfer the result:

import javax.xml.bind.annotation.XmlAccessType
import javax.xml.bind.annotation.XmlAccessorType
@XmlAccessorType(XmlAccessType.FIELD)
class XxxDto {
    Integer val
}

Hope this helps!

Jonathan


On 19 July 2010 20:50, Chris C. <[hidden email]> wrote:

>
> This is beyond frustrating now...  I've got a deadline of tomorrow morning to
> figure this out, or we ditch grails completely.  I tried adding the
> dependencies {} bit to the BuildConfig.groovy of a clean project, but it
> made no difference.  It still gets a compile error.
>
> I really appreciate all of the help being offered, unfortunately, bits and
> pieces just aren't cutting it for me.  I've never felt this stupid in my
> life before!  Does anyone have a "basic Grails + Maven + SOAP consuming
> application skeleton for Dummies" with every include, dependancy etc.
> spelled out?
>
> Jonathon, did you add groovyws as a maven dependency?  What version of the
> JDK are you using?  What version of Grails?  or Maven?  Did you also have to
> do the pom dependency entries specified in a previous reply?  What about the
> "pom true" setting in the BuildConfig.groovy -- do you use that?
>
> There's enough people posting that this is possible that I believe it.
> However, I've spent FIVE DAYS trying to get this thing to work and it's just
> one issue after another.  I don't have the patience to figure out all of the
> dependencies and my architect figures that if there are that many dependancy
> issues, it's probably not suitable for anything close to a mission critical
> application anyway.
>
> Thanks again for the replies, but short of a step-by-step guide, I think I'm
> done here.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2294510.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

rlovtangen
In reply to this post by Chris C.
Chris, I sent you an example project using grails 1.3.2 and maven (grails 1.3.2 because there's no 1.3.3 archetype yet)

It was not that straight forward, I got the error: Both jaxb:version and version are present
Looks like there is a bug in JDK6, from 1.6.0_18 to 1.6.0_20, and I'm on 1.6.0_20, the latest update on OS X.
http://metro.1045641.n5.nabble.com/Both-jaxb-version-and-version-are-present-tt1067289.html#a1067289
https://jaxp.dev.java.net/issues/show_bug.cgi?id=63

I worked around this issue by not excluding com.sun.xml.bind:jaxb-xjc and com.sun.xml.bind:jaxb-impl after all. Then those jars took precedence over the JDK, and it worked.

When running from a test I also got some bugging about missing spring-asm, so I included org.springframework:spring-asm:3.0.3.RELEASE, don't know if its necessary.


What I basicly did was this:

$mvn archetype:generate -DarchetypeGroupId=org.grails -DarchetypeArtifactId=grails-maven-archetype -DarchetypeVersion=1.3.2 -DgroupId=example -DartifactId=my-app
$cd my-app
changed jdk version to 1.6 in pom.xml
mvn initialize

added to dependencies in pom.xml:

          <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-asm</artifactId>
                  <version>3.0.3.RELEASE</version>
          </dependency>

          <dependency>
                  <groupId>org.codehaus.groovy.modules</groupId>
                  <artifactId>groovyws</artifactId>
                  <version>0.5.2</version>
                  <exclusions>
                          <exclusion>
                                  <groupId>org.apache.geronimo.specs</groupId>
                                  <artifactId>geronimo-servlet_2.5_spec</artifactId>
                          </exclusion>
                          <exclusion>
                                  <groupId>org.mortbay.jetty</groupId>
                                  <artifactId>servlet-api</artifactId>
                          </exclusion>
                          <!--don't exclude theese two dependencies if your on jdk 1.6.0_18 to 1.6.0_20 because of http://metro.1045641.n5.nabble.com/Both-jaxb-version-and-version-are-present-tt1067289.html#a1067289 -->
                          <!--<exclusion>-->
                          <!--<groupId>com.sun.xml.bind</groupId>-->
                          <!--<artifactId>jaxb-xjc</artifactId>-->
                          <!--</exclusion>-->
                          <!--<exclusion>-->
                          <!--<groupId>com.sun.xml.bind</groupId>-->
                          <!--<artifactId>jaxb-impl</artifactId>-->
                          <!--</exclusion>-->
                          <exclusion>
                                  <groupId>xml-apis</groupId>
                                  <artifactId>xml-apis</artifactId>
                          </exclusion>
                          <exclusion>
                                  <groupId>com.sun.xml.messaging.saaj</groupId>
                                  <artifactId>saaj-impl</artifactId>
                          </exclusion>
                  </exclusions>
          </dependency>


added dependencyManagement in pom.xml (right before <build>):


        <dependencyManagement>
                <dependencies>

                        <dependency>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-bundle</artifactId>
                                <version>2.2.7</version>
                                <exclusions>
                                        <exclusion>
                                                <groupId>org.slf4j</groupId>
                                                <artifactId>slf4j-jdk14</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>xerces</groupId>
                                                <artifactId>xmlParserAPIs</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>javax.xml.bind</groupId>
                                                <artifactId>jaxb-api</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>javax.xml.soap</groupId>
                                                <artifactId>saaj-api</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>org.apache.xmlbeans</groupId>
                                                <artifactId>xmlbeans</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>jaxen</groupId>
                                                <artifactId>jaxen</artifactId>
                                        </exclusion>
                                        <exclusion>
                                                <groupId>org.apache.geronimo.specs</groupId>
                                                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
                                        </exclusion>
                                </exclusions>
                        </dependency>
                                               
                </dependencies>
        </dependencyManagement>




created a controller:


package example

import groovyx.net.ws.WSClient

class FooController {

    def index = {
            def proxy = getProxyForWsdl("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL")
            def result = proxy.CelsiusToFahrenheit(0)
            render "You are probably freezing at ${result} degrees Farhenheit"
    }


        private def getProxyForWsdl(String wsdl) {
                def proxy = new WSClient(wsdl,  this.class.classLoader)
                proxy.initialize()
                return proxy
        }

}


run
$mvn grails:run-app

opened http://localhost:8080/my-app/foo/index

Ronny





On Jul 19, 2010, at 9:50 PM, Chris C. wrote:

>
> This is beyond frustrating now...  I've got a deadline of tomorrow morning to
> figure this out, or we ditch grails completely.  I tried adding the
> dependencies {} bit to the BuildConfig.groovy of a clean project, but it
> made no difference.  It still gets a compile error.
>
> I really appreciate all of the help being offered, unfortunately, bits and
> pieces just aren't cutting it for me.  I've never felt this stupid in my
> life before!  Does anyone have a "basic Grails + Maven + SOAP consuming
> application skeleton for Dummies" with every include, dependancy etc.
> spelled out?
>
> Jonathon, did you add groovyws as a maven dependency?  What version of the
> JDK are you using?  What version of Grails?  or Maven?  Did you also have to
> do the pom dependency entries specified in a previous reply?  What about the
> "pom true" setting in the BuildConfig.groovy -- do you use that?
>
> There's enough people posting that this is possible that I believe it.
> However, I've spent FIVE DAYS trying to get this thing to work and it's just
> one issue after another.  I don't have the patience to figure out all of the
> dependencies and my architect figures that if there are that many dependancy
> issues, it's probably not suitable for anything close to a mission critical
> application anyway.
>
> Thanks again for the replies, but short of a step-by-step guide, I think I'm
> done here.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/WSClient-GroovyWS-can-t-get-them-to-work-for-SOAP-based-WS-tp2291376p2294510.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Chris C.
First off, a big thanks to Ronny L. for all of his assistance.  Using the detailed instructions in his last post, I was able to get almost there.  (I think the piece I was missing was changing the 1.5 to a 1.6 for the java version in the pom.xml before running the 'mvn initialize'.)

Anyway, I had one last hurdle which turned out to not be a dependency thing, but a stupid Windows pathing issue.  (Yes, you Mac and Linux people can go ahead and laugh.)

By default, maven uses ${user_home}/.m2/repository.  On a Linux system, this is fine, but under Windows the user_home contains the directory "Documents and Settings".  The spaces in the directory name caused a bad path exception.

I worked around this by modifying the settings.xml in ${user_home}/.m2 to point maven at "C:\maven\.m2\repository" as the repository.

After doing that (and waiting to download everything all over again), I was able to run my application and call a SOAP web service that I had written.

Hallelujah!

And thanks again to everyone for their help.  Hopefully this thread will prove useful to anyone else trying this out.
Reply | Threaded
Open this post in threaded view
|

Re: WSClient / GroovyWS - can't get them to work for SOAP-based WS!

Sadhna Singh
In reply to this post by rlovtangen
Ronny,
Your post was very helpful when i first used  groovyWS.
My application using grails 2.1.0, jdk 6 and groovyWS 1.0 plugin for connection WS.

Recently we upgraded to jdk7 and everything stopped working.
and saying jdk compatibility issue.

Please help
Sana