views:

94

answers:

0

I'm using the following lines of code to call the web-service below:

 def wsdl = 'http://somewhere.com/services/msgService?wsdl'  
 proxy = new WSClient(wsdl, this.class.classLoader)  
 proxy.initialize()  

 def msg = proxy.create("com.somwhere.test.api.MsgService")
 msg.applicationName = "APP1"  
 msg.clientId = 5  
 msg.additionalProperties = [test:3]  

for web-service

  <xs:schema targetNamespace="http://somewhere.com/test/api/MsgService" version="1.0" xmlns:tns="http://somewhere.com/test/api/MsgService" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;  
 <xs:element name="sendMessage" type="tns:sendMessage"/>  
   <xs:complexType name="sendMessage">  
    <xs:sequence>  
     <xs:element minOccurs="0" name="mRequest" type="tns:mServiceRequest"/>  
    </xs:sequence>  
   </xs:complexType>  
   <xs:complexType name="mServiceRequest">  
    <xs:sequence>  
     <xs:element name="additionalProperties">  
      <xs:complexType>  
       <xs:sequence>  
        <xs:element maxOccurs="unbounded" minOccurs="0" name="entry">  
         <xs:complexType>  
          <xs:sequence>  
           <xs:element minOccurs="0" name="key" type="xs:string"/>  
           <xs:element minOccurs="0" name="value" type="xs:anyType"/>  
          </xs:sequence>  
         </xs:complexType>  
        </xs:element>  
       </xs:sequence>  
      </xs:complexType>  
     </xs:element>  
     <xs:element minOccurs="0" name="applicationName" type="xs:string"/>  
     <xs:element minOccurs="0" name="clientId" type="xs:long"/>  
     .......  
    </xs:sequence>  
   </xs:complexType>  
  </xs:schema>  

But get the following error:

Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '{test=3}' with class 'java.util.LinkedHashMap' to class 'com.somwhere.test.api.MsgService$AdditionalProperties'

However, when the additionalProperties are an empty map, i.e. [:] it works fine.

What am I doing wrong? How must I format the map, or what other object do I need to use in order for it to work?