Re: Using Arrays in DII calls

From: Arun Gupta <arun.gupta_at_Sun.COM>
Date: Fri, 12 Apr 2002 10:45:25 -0700

Hi Michael,

Please refer to my posting at
on using a String[] in DII client.

Thanks for your interest in JAX-RPC.


YAWN,MICHAEL (HP-Cupertino,ex1) wrote:

>Followup to yesterday's question:
>Trying to access a service whose methods return Arrays. One is an array of
>strings, the other an array of structure types.
>What is the correct specification of the return type of a method that
>returns an array of strings? Of a method that returns an array of structs?
>First attempt:
> String NS_SOAP_ENC =
> "";
> new QName(NS_SOAP_ENC, "ArrayOfstring"
> call.setReturnType(QNAME_TYPE_ARRAY, String[].class);
>This fails at runtime with the error
>Couldn't match: class [Ljava.lang.String;,
>Exception in thread "main" serialization error: no serializer is registered
>(class [Ljava.lang.String;,
>An equivalent error is seen if String[] is replaced by Object[].
>Next attempt:
>I at least make some progress if I replace 'ArrayOfstring' with the more
>generic 'Array'.
>I don't get the 'couldn't match' error, but instead get
>Exception in thread "main" HTTP transport error:
>java.lang.IllegalArgumentException: Illegal MimeHeader name or value
>Any explanation of the above error and how to correct it would be helpful.
>But getting back to the first case. When running via stubs, xrpcc generates
>a bunch
>of serializer and deserializer classes that know how to map, for example, an
>ArrayOfstring to a Java String[]. In the DII case, these classes aren't
>but they are obviously still needed. How do I generate them on-the-fly?
>My WSDL document defines the various types I need serializers and
>for (e.g., ArrayOfstring). But I don't see any way to query the
>to see whether any conversions are defined for that type. I can query the
>TypeMappingRegistry for namespaces supported (I see SOAP-ENC and a blank
>namespace, but not the target namespace from my WSDL). For a namespace,
>I cannot see a way to get a list of the defined conversions. I can see
>specific conversions are registered -- so I tested various combinations of
>String[], Object[], Array, and ArrayOfstring, and only the Object[] to Array
>mapping was found. This at least matches the behavior seen in the program.
>I'm not sure how to solve my problem:
>- Do I need to write my own Serializers and Deserializers for conversions of
> the array types? This seems odd given that JAX-RPC already knows how
> to create exactly the ones I need.
>- Should I just go with mapping everything to an Object[] and casting? If
> how do I resolve the 'Illegal MimeHeader name or value' error that I get
> treating my return array as an Object[]?

There is only one me, I must live myself!
There is only one today, I must live itself!