users@jaxb.java.net

Re: Accessor for _at_XMLList-annotated properties??

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 19 Aug 2009 13:44:14 +0200

Is the Java code you show generated with xjc?

When I generate Java code from the corresponding Schema
(...xs:simpleType><xs:string itemType="xs:string"/>...)
there is also an @XmlElement(required="true") annotation after the @XmlList.
I can't say whether this helps, but it's worth a try.

If the Java code is hand-written and the aformentioned addition fails, I'd
suggest that you cheat on the client side and define your SetSubscriptions
simply as:

public class SetSubscriptions {

   protected String fooType;

   public void setFooType( List<String> fooList ){
      ... a few obvious lines...
   }
}

-W


On Tue, Aug 18, 2009 at 9:33 PM, Kristofor Jacobson <
kristofor.jacobson_at_gmail.com> wrote:

> Hi guys,
> I'm building a JaxWS client to a .NET (3.5) web service. I'll skip
> the agony I encountered trying to get Metro working with the service
> (which uses Transport encryption and message authentication). For
> now, I just hacked out the WS-I portion of the WSDL so that I can use
> plain JAXWS.
>
> Now the problem is that one of the web service operations expects a
> space-separated list in a single parameter. At build-time,
> wsimport/jaxb generates a binding object that employes @XmlList on one
> of its properties:
>
>
> 8<--------------------------------------------------------------------------------------------------------
>
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "", propOrder = {
> "fooType"
> })
> @XmlRootElement(name = "SetFoos")
> public class SetSubscriptions {
>
> @XmlList
> protected List<String> fooType;
>
>
> 8<--------------------------------------------------------------------------------------------------------
>
> This is fine, but when deployed, I get "WebServiceException" as follows:
>
>
> 8<--------------------------------------------------------------------------------------------------------
> SEVERE: WSSERVLET11: failed to parse runtime descriptor:
> javax.xml.ws.WebServiceException: class
> com.me.myproduct.module.partner.product.SetFoos do not have a property
> of the name {http://tempuri.org/}fooType <http://tempuri.org/%7DfooType>
> [java] javax.xml.ws.WebServiceException: class
> com.me.myproduct.module.partner.product.SetFoos do not have a property
> of the name {http://tempuri.org/}fooType <http://tempuri.org/%7DfooType>
> [java] at
>
> com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:510)
> [java] at
>
> com.sun.xml.ws.server.sei.EndpointMethodHandler.createArgumentsBuilder(EndpointMethodHandler.java:133)
> [java] at
>
> com.sun.xml.ws.server.sei.EndpointMethodHandler.<init>(EndpointMethodHandler.java:106)
> [java] at
>
> com.sun.xml.ws.server.sei.PayloadQNameBasedDispatcher.<init>(PayloadQNameBasedDispatcher.java:106)
> [java] at
>
> com.sun.xml.ws.server.sei.EndpointMethodDispatcherGetter.<init>(EndpointMethodDispatcherGetter.java:72)
>
> 8<--------------------------------------------------------------------------------------------------------
>
> I checked out the source for JAXB-RI 2.1.6 and put it in debug. The
> exception that is being thrown at line 510 of
> EndpointArgumentsBuilder$DocLit is caused by the call to
> getElementPropertyAccessor on the JAXBContext at line 499. The
> fooType property of the SetFoos element has the @XmlList annotation,
> and the binding information property impl class for the property is
> "ListElementProperty", which extends PropertyImpl (via ArrayProperty).
> Neither ListElementProperty nor ArrayProperty override
> getElementPropertyAccessor(), so at runtime, a null value is returned
> for the accessor and the exception is thrown.
>
> I can't change the WSDL/XSD provided by our business partner. What
> is the correct way to approach this? Is ListElementProperty broken?
> Thanks for any input :)
>
> -kris-
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>