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.
Many thanks Bill.
I just want to add some info for future readers.
To turn on logging for GroovyWS in Grails:
log4j = {
debug 'grails.app',
'groovyx.net.ws',
'org.apache.cxf'
}
With this as mentioned Bill you can see the names of the classes.
One more thing: parameters
may have different type. Not List<?>
. That's why it should be created too.
def params = proxy.create('com.temp.feeds.FeedRequestType$Parameters');
To retrieve available methods and fields for newly created objects you can use Groovy reflection:
params.class.methods.each{
println it;
}
params.class.fields.each{
println it;
}
That's all!
-vova