You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sagara Gunathunga <sa...@gmail.com> on 2011/12/01 03:50:54 UTC
Re: webservice returning POJO with id field - typemapping problem
Something weird I have tested this and Schema generated successfully.
<xs:element minOccurs="0" name="id" nillable="true" type="xs:long"/>
Thanks !
On Sat, Nov 26, 2011 at 3:37 PM, Nick Kolosov <de...@mail.ru> wrote:
> Hello.
>
> I am writing webservice returning simple POJO using axis2 lib:
>
> public class Dict {
> Long id;
> String name;
> public Long getId() { return id; }
> public String getName() { return name; }
> public void setId(Long id) { this.id = id; }
> public void setName(String name) { this.name = name; }
> }
>
> Test webservice is:
>
> public class TestService {
> public Dict[] getDict() {
> List<Dict> dicts = new ArrayList<Dict>();
> return types.toArray(new Dict[1]);
> }
> }
>
> I run java2wsdl and got wsdl with the Dict described as
>
> <xs:complexType name="RoundingType">
> <xs:sequence>
> <xs:element minOccurs="0" name="id" nillable="true"
> type="xs:anyType"/>
> <xs:element minOccurs="0" name="name" nillable="true"
> type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
>
>
> Here the id field has type anyType which cause problems when being mapped
> back in webservice client.
> But if i change getId and setId methods to getId1 and setId1 for example,
> i get proper mapping:
>
> <xs:complexType name="RoundingType">
> <xs:sequence>
> <xs:element minOccurs="0" name="id1" nillable="true"
> type="xs:long"/>
> <xs:element minOccurs="0" name="name" nillable="true"
> type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
>
> So, whats so special about "id" field ? How can i instruct axis2 to map is
> as long, not anyType ?
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.**apache.org<ja...@axis.apache.org>
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
--
Sagara Gunathunga
Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara