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 Leon Hwang <hw...@mystrands.com> on 2007/08/29 23:33:09 UTC

[Axis2] Axis2 and New field

Greetings,

I am writing a server that returns an object, say User object, containing only username.
I create a client using its wsdl (with option -d adb -uw -Eosv).
The client is able to retrieve username field correctly.

Later I added one more field to User object, say password, and redeployed it to the server.
Now the client complains about the field with "unexpected subelement password". (ADBException)

This will happen a lot in business world as their spec changes.

Is there some way (either in client or server) we can make it ignore extra elements?

Thanks in advance.








---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2] Axis2 and New field

Posted by Leon Hwang <hw...@mystrands.com>.
Hi, Sanjiva,

What do you mean "extensibility element"?

I am using the WSDL that is generated by Axis2 1.3 on-the-fly, which has following schema.

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://user.types.openapi.strands.com/xsd">
<xs:complexType name="UserBean10">
<xs:sequence>
<xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="email" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="id" type="xs:long"/>
<xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

I can rewrite the wsdl on myself (I will try with the way Amila suggested),
but I would really love to use auto-generated WSDL.
So if there is any configuration property I can change that would be great.


In the mean time, I would appreciate if you could specify "extensibility element" in this schema.
Thanks,

- Leon


Sanjiva Weerawarana wrote:
> Does the schema allow extensibility elements? If so we should be reading 
> those in correctly; if not its a bug.
> 
> Sanjiva.
> 
> Amila Suriarachchi wrote:
>>
>>
>> On 8/30/07, *Leon Hwang* <hwang@mystrands.com 
>> <ma...@mystrands.com>> wrote:
>>
>>     Greetings,
>>
>>     I am writing a server that returns an object, say User object,
>>     containing only username.
>>     I create a client using its wsdl (with option -d adb -uw -Eosv).
>>     The client is able to retrieve username field correctly.
>>
>>     Later I added one more field to User object, say password, and
>>     redeployed it to the server.
>>     Now the client complains about the field with "unexpected subelement
>>     password". (ADBException)
>>
>>     This will happen a lot in business world as their spec changes.
>>
>>     Is there some way (either in client or server) we can make it ignore
>>     extra elements?
>>
>> Please try this. change your complex type to
>> all instead of sequence. and see.
>>
>> if the above is not works then the only option is to regenerate the 
>> code with new schema. But please log a jira about this so that we will 
>> be able to provide you a better solution.
>>
>>     Thanks in advance.
>>
>>
>>
>>
>>
>>
>>
>>
>>     ---------------------------------------------------------------------
>>     To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>>     <ma...@ws.apache.org>
>>     For additional commands, e-mail: axis-dev-help@ws.apache.org
>>     <ma...@ws.apache.org>
>>
>>
>>
>>
>> -- 
>> Amila Suriarachchi,
>> WSO2 Inc.
> 

-- 
Leon Hwang
Senior Tech Lead
MyStrands Inc.

work: 1.541.753.4426
mobile: 1.541.740.7511
fax: 1.541.754.6416
email: hwang@mystrands.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [Axis2] Axis2 and New field

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Does the schema allow extensibility elements? If so we should be reading 
those in correctly; if not its a bug.

Sanjiva.

Amila Suriarachchi wrote:
> 
> 
> On 8/30/07, *Leon Hwang* <hwang@mystrands.com 
> <ma...@mystrands.com>> wrote:
> 
>     Greetings,
> 
>     I am writing a server that returns an object, say User object,
>     containing only username.
>     I create a client using its wsdl (with option -d adb -uw -Eosv).
>     The client is able to retrieve username field correctly.
> 
>     Later I added one more field to User object, say password, and
>     redeployed it to the server.
>     Now the client complains about the field with "unexpected subelement
>     password". (ADBException)
> 
>     This will happen a lot in business world as their spec changes.
> 
>     Is there some way (either in client or server) we can make it ignore
>     extra elements?
> 
> Please try this. change your complex type to
> all instead of sequence. and see.
> 
> if the above is not works then the only option is to regenerate the code 
> with new schema. But please log a jira about this so that we will be 
> able to provide you a better solution.
> 
>     Thanks in advance.
> 
> 
> 
> 
> 
> 
> 
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
> 
> 
> 
> 
> -- 
> Amila Suriarachchi,
> WSO2 Inc.

-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [Axis2] Axis2 and New field

Posted by Leon Hwang <hw...@mystrands.com>.
Amila,

I noticed someone has already reported this on Jira.

http://issues.apache.org/jira/browse/AXIS2-3037

Looking at Comments on this page, you said you have added an option to off the strict validations and it won't be Axis2 1.3.
Could you please tell me what the option (WSDL2Java) is?
I suppose this is a different option from -Eosv as it already made into 1.3 and it seems it doesn't work.

Also is it under SVN nightly-build?

Thank you again.

- Leon

Amila Suriarachchi wrote:
> 
> 
> On 8/30/07, *Leon Hwang* <hwang@mystrands.com 
> <ma...@mystrands.com>> wrote:
> 
>     Greetings,
> 
>     I am writing a server that returns an object, say User object,
>     containing only username.
>     I create a client using its wsdl (with option -d adb -uw -Eosv).
>     The client is able to retrieve username field correctly.
> 
>     Later I added one more field to User object, say password, and
>     redeployed it to the server.
>     Now the client complains about the field with "unexpected subelement
>     password". (ADBException)
> 
>     This will happen a lot in business world as their spec changes.
> 
>     Is there some way (either in client or server) we can make it ignore
>     extra elements?
> 
> Please try this. change your complex type to
> all instead of sequence. and see.
> 
> if the above is not works then the only option is to regenerate the code 
> with new schema. But please log a jira about this so that we will be 
> able to provide you a better solution.
> 
>     Thanks in advance.
> 
> 
> 
> 
> 
> 
> 
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
> 
> 
> 
> 
> -- 
> Amila Suriarachchi,
> WSO2 Inc.

-- 
Leon Hwang
Senior Tech Lead
MyStrands Inc.

work: 1.541.753.4426
mobile: 1.541.740.7511
fax: 1.541.754.6416
email: hwang@mystrands.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [Axis2] Axis2 and New field

Posted by Amila Suriarachchi <am...@gmail.com>.
On 8/30/07, Leon Hwang <hw...@mystrands.com> wrote:
>
> Greetings,
>
> I am writing a server that returns an object, say User object, containing
> only username.
> I create a client using its wsdl (with option -d adb -uw -Eosv).
> The client is able to retrieve username field correctly.
>
> Later I added one more field to User object, say password, and redeployed
> it to the server.
> Now the client complains about the field with "unexpected subelement
> password". (ADBException)
>
> This will happen a lot in business world as their spec changes.
>
> Is there some way (either in client or server) we can make it ignore extra
> elements?

Please try this. change your complex type to
all instead of sequence. and see.

if the above is not works then the only option is to regenerate the code
with new schema. But please log a jira about this so that we will be able to
provide you a better solution.

Thanks in advance.
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: [Axis2] Axis2 and New field

Posted by Leon Hwang <hw...@mystrands.com>.
Thank you, Norris.

Yes I am using 1.3 and it didn't work.
I understand that it will work if I modify the java code or xslt file.
However, I am more concerned about my clients who probably don't want to waste time looking into Axis2 code.
I could explain to them change such such lines and recompile, but that is a lot of hassle.
It would be very nice if the feature is built in Axis2.

Thanks,

- Leon

Merritt, Norris wrote:
> See the earlier thread (attached) on this issue. I haven't had the
> opportunity to try -Eosv with Axis2 1.3 yet. I'm curious, are you using
> Axis 1.3 or an earlier version?
> 
> As I explained in my earlier post, the only way I have been able to work
> around this issue is to modify the XSLT contained in the
> axis2-adb-codegen jar file to cause different client code to be emitted.
> Basically you need the generated client code to silently consume the
> unexpected elements / subelements as it is pull-parsing responses,
> instead of throwing an exception.
> 
> -----Original Message-----
> From: Leon Hwang [mailto:hwang@mystrands.com] 
> Sent: Wednesday, August 29, 2007 2:33 PM
> To: axis-dev@ws.apache.org; axis-user@ws.apache.org
> Subject: [Axis2] Axis2 and New field
> 
> Greetings,
> 
> I am writing a server that returns an object, say User object,
> containing only username.
> I create a client using its wsdl (with option -d adb -uw -Eosv).
> The client is able to retrieve username field correctly.
> 
> Later I added one more field to User object, say password, and
> redeployed it to the server.
> Now the client complains about the field with "unexpected subelement
> password". (ADBException)
> 
> This will happen a lot in business world as their spec changes.
> 
> Is there some way (either in client or server) we can make it ignore
> extra elements?
> 
> Thanks in advance.
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Subject:
> RE: Newbie question about using axis as webservice client
> From:
> "Merritt, Norris" <no...@hp.com>
> Date:
> Fri, 3 Aug 2007 17:27:09 -0000
> To:
> <ax...@ws.apache.org>
> 
> To:
> <ax...@ws.apache.org>
> CC:
> <de...@gmail.com>
> 
> 
> Axis2 adb style clients can be made tolerant of new elements added to a web service by modifying ADBBeanTemplate.xsl contained in axis2-adb-codegen-1.2.jar.
> 
> This xsl is used to generate the Java code which pull-parses responses from the web service. This generated code is what throws exceptions when it encounters unrecognized elements. It is fairly trivial to modify the xsl to generate code which is tolerant of newly-added elements (i.e. just silently consumes and discards them) instead of crashing. I have done this. To some no doubt this is heresy, to others (myself included) it is worthwhile because it can be used to achieve looser coupling between the client and service, and that is good. There are many business use cases where a service is extended with some new elements which are not needed by existing clients. The notion that every previously deployed client should have to be recompiled and redeployed just because the service was extended is broken, IMHO.
> 
>  
> 
>   _____  
> 
> From: Lahiru Sandakith [mailto:sandakith@gmail.com] 
> Sent: Friday, August 03, 2007 4:13 AM
> To: axis-user@ws.apache.org
> Subject: Re: Newbie question about using axis as webservice client
> 
>  
> 
> Hi DelGurth,
> 
> As you say the webservice changed then the wsdl also should be different, so IMO there is no option other than regenerating the client using wsdl2java tool (via Eclipse), because its an interface level change.
> 
> Thanks 
> 
> Lahiru Sandakith
> 
> On 8/3/07, DelGurth <de...@gmail.com> wrote:
> 
> Hi,
> 
> I recently stated using axis as my web service client. I've used the
> wsdl2java tool (via Eclipse) to generate the client code based on the
> wsdl file of the service.
> 
> Now the web service changed, it contains a new field, and my client 
> application doesn't work anymore. Is there a way to make my client
> ignore fields that are unknown to it?
> 
> I tried finding an answer in the client-side axis documentation, but I
> can't find it, unfortunately. That's why I end up here. 
> 
> Regards,
> Wessel van Norel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org 
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org

-- 
Leon Hwang
Senior Tech Lead
MyStrands Inc.

work: 1.541.753.4426
mobile: 1.541.740.7511
fax: 1.541.754.6416
email: hwang@mystrands.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: [Axis2] Axis2 and New field

Posted by "Merritt, Norris" <no...@hp.com>.
See the earlier thread (attached) on this issue. I haven't had the
opportunity to try -Eosv with Axis2 1.3 yet. I'm curious, are you using
Axis 1.3 or an earlier version?

As I explained in my earlier post, the only way I have been able to work
around this issue is to modify the XSLT contained in the
axis2-adb-codegen jar file to cause different client code to be emitted.
Basically you need the generated client code to silently consume the
unexpected elements / subelements as it is pull-parsing responses,
instead of throwing an exception.

-----Original Message-----
From: Leon Hwang [mailto:hwang@mystrands.com] 
Sent: Wednesday, August 29, 2007 2:33 PM
To: axis-dev@ws.apache.org; axis-user@ws.apache.org
Subject: [Axis2] Axis2 and New field

Greetings,

I am writing a server that returns an object, say User object,
containing only username.
I create a client using its wsdl (with option -d adb -uw -Eosv).
The client is able to retrieve username field correctly.

Later I added one more field to User object, say password, and
redeployed it to the server.
Now the client complains about the field with "unexpected subelement
password". (ADBException)

This will happen a lot in business world as their spec changes.

Is there some way (either in client or server) we can make it ignore
extra elements?

Thanks in advance.








---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org