GroovyWS and complex requests

前端 未结 3 1774
天涯浪人
天涯浪人 2020-12-30 11:22

I\'ve faced with a problem of sending complex requests with GroovyWS.

This is sample request generated by soapUI:



        
3条回答
  •  臣服心动
    2020-12-30 12:14

    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.

提交回复
热议问题