greenstar wrote:
Consider this example client:

@WebServicetargetNamespace="http://foobar.com";)
public interface Test {

    @WebMethod(operationName = "x")
    public String x(
@WebParam(name = "values") String[] values); }

Using JaxWsProxyFactoryBean, the array argument gets marshalled to:

<values>1</values>
<values>2</values>
<values>3</values>

I would like to marshal it like this:

<values>
  <value>1</value>
  <value>2</value>
  <value>3</value>
</values>

This seems like this would make it much easier to determine between an empty
array and "not provided" (ie: null) at the other end.  When I send an empty
array, it gets unmarshalled to a null at the other end because it can't tell
the difference.

I can make a wrapper object and things work fine, but shouldn't the standard
simple case using arrays work in a safer way?  What am I missing?

I think this is what the @XmlElementWrapper JAXB annotation does, but to use that you'd have to create the request wrapper bean explicitly (either manually or with the wsgen tool from Java 6 or Metro) and then annotate the values property in that with @XmlElementWrapper.

I guess the alternative would be to create your wrapper object and then register a type adapter to use your wrapper object in place of String[].

Neither option is particularly elegant :-(

Ian

--
Ian Roberts               | Department of Computer Science
[EMAIL PROTECTED]  | University of Sheffield, UK

Reply via email to