I've faced with a problem of sending complex requests with GroovyWS.
This is sample request generated by soapUI:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dex="http://www.temp.com/com/dex"
>
<soapenv:Header/>
<soapenv:Body>
<dex:executeRequest>
<!--Optional:-->
<a>?</a>
<!--Optional:-->
<b>?</b>
<!--Optional:-->
<parameters>
<!--Zero or more repetitions:-->
<parameter>
<!--Optional:-->
<key>?</key>
<!--Optional:-->
<value>?</value>
</parameter>
</parameters>
<!--Optional:-->
<c>?</c>
<!--Optional:-->
<d>?</d>
</dex:feedrequest>
</soapenv:Body>
</soapenv:Envelope>
the piece of groovy code:
def proxy = webService.getClient(grailsApplication.config.ws.endpoint);
proxy.processdRequest(?);
So what I should pass instead of ?.
Thanks for you help.
-vova.
GroovyWS dynamically creates classes for each of the argument types you need in order to pass data to the web service call. For instance, if the webservice call was:
public int passSomeArgs( Arg1Type a, Arg2Type b );
GroovyWS would dynamically create an Arg1Type class and an Arg2Type class, which you could access via a method on the proxy.
// this will instantiate an Arg1Type for you
def arg1 = proxy.create( "ns1.ns2.Arg1Type" );
// this will instantiate an Arg2Type for you
def arg2 = proxy.create( "ns1.ns2.Arg2Type" );
You can then populate the arg1/arg2 instance with data and make your call:
int ret = proxy.passSomeArgs( arg1, arg2 );
Note, there are probably some namespaces involved in the classes being created. I used the CXF logging that was printed as GroovyWS was processing the WSDL to see what CXF thought the class names should actually be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With