Is this with Aegis databinding or JAXB?

JAXB doesn't really support Hashtables or maps or anything "natively".   If 
you create a service with it and check the schema, you get a complexType named 
"hashtable" that extends a complexType named "dictionary" which is just an 
empty sequence.   Not really useful. 

However, you CAN get it to work if you write a custom XmlAdapter.  The 
java_first_jaxws sample that we ship in CXF contains an example of writing an 
adapter to handle a Map.   You should be able to use that as a starting point.

Dan


On Wed May 20 2009 10:05:57 am Kent Närling wrote:
> We have a problem getting Hashtable parameters getting passed properly
> in a webservice request, for instance I created a test method like:
>
>       @WebMethod(operationName="doSomething")
>       Hashtable<String, String> doSomething(
>                       @WebParam(name="action") String action,
>                       @WebParam(name="extraFields") Hashtable<String, String> 
> extraFields);
>
>
> And then try to call this from a client with:
>
>               Hashtable<String, String> extraFields = new Hashtable<String, 
> String>();
>               extraFields.put("profileId", "42");
>               Hashtable<String, String> result = link.doSomething("GO", 
> extraFields);
>               System.err.println("result[text]= " + result.get("text"));
>
> And a test server implementation:
>
>               System.err.println("action = " + action + " profileId = " +
> extraFields.get("profileId"));
>
>               Hashtable<String, String> result = new Hashtable<String, 
> String>();
>               result.put("text", "TEST");
>               return result;
>
>
> But the printouts just become:
> (server) action = GO profileId = null
> (client) result[text]= null
>
> And the actual data sent in the request is just:
> <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body><ns2:doSo
>mething
> xmlns:ns2="http://ersifextlink.interfaces.ers.seamless.com/";><action>GO</ac
>tion><extraFields/></ns2:doSomething></soap:Body></soap:Envelope>
>
> The funny thing is that if we wrap the parameter in our own class
> CONTAINING a java.util.Hashtable, then it seems to WORK?!?
>
> Any hints? are we missing some information in the annotations? or is
> this a CXF specific issue?

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to