Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Changing WSDL = recreate axis java client? (http://www.velocityreviews.com/forums/t532221-changing-wsdl-recreate-axis-java-client.html)

matrixhasu 08-24-2007 02:32 PM

Changing WSDL = recreate axis java client?
 
Hi all,
we'd like to recieve your opinion about a strange and unexpected issue
we're facing right now: we have a web service for which we've provided
a jar java client (generated with axis and wsdl2java) to some users.

We had to modify that web service to include two additional response
fields. After web service modification, the java client stops working
reporting

org.xml.sax.SAXException: Invalid element in
com.webmethods.www.__outputJobInfo - DESCRIPTION

where "DESCRIPTION" is the first additional field.

Did you already face this problem? How would I solve it? I thought
clients would be indipendent to web services output values, if that
change only involve additional fields (i.e., not modify existing one).

Is there some other library/way-to-invoke-ws without have to change
(and thus notify everyone using it) the jar client?

Thanks in advance for your help.

Regards,
Sandro


Ian Wilson 08-24-2007 03:28 PM

Re: Changing WSDL = recreate axis java client?
 
matrixhasu wrote:
> we have a web service for which we've provided
> a jar java client (generated with axis and wsdl2java) to some users.
>
> We had to modify that web service to include two additional response
> fields. After web service modification, the java client stops working
> reporting
>
> org.xml.sax.SAXException: Invalid element in
> com.webmethods.www.__outputJobInfo - DESCRIPTION
>
> where "DESCRIPTION" is the first additional field.
>
> Did you already face this problem? How would I solve it?


I include an API version number as part of the namespace. I provide both
old and new services in parallel until all the clients have transitioned.

> I thought
> clients would be indipendent to web services output values, if that
> change only involve additional fields (i.e., not modify existing one).


Some client web-server technologies are much more tolerant of this than
others. Perl's SOAP::Lite for example, but it depends how the client is
coded. In general, if I change the API I expect to have to change the
clients.

blazer 08-28-2007 06:47 PM

Re: Changing WSDL = recreate axis java client?
 
Hi all,

This is in response to the posting I've seen regarding AXIS and web
services client libaries blowing up when a WSDL document changes.

Basically the error occurs because a mapping does not exist between an
entry in the WSDL document and your client class. Modifying the
client class as follows will prevent this error from being thrown.

Here's what I had to do to fix the issue:

1) Create a class that extends
org.apache.axis.encoding.ser.BeanDeserializer.
a) Create constructors that basically pass the parameters to the
super class.
b) Override the following method as follows:
@Override
public SOAPHandler onStartChild(String arg0, String arg1, String
arg2, Attributes arg3, DeserializationContext arg4) throws
SAXException {
// TODO Auto-generated method stub
try{
return super.onStartChild(arg0, arg1, arg2, arg3, arg4);
}catch (SAXException e){
return null;
}
}
2) Find the object that is being returned from the web service -
(client class).
a) Override the following method as follows:
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer
getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return new BigYDeserializer(_javaType, _xmlType, typeDesc);

//new org.apache.axis.encoding.ser.BeanDeserializer(
// _javaType, _xmlType, typeDesc);
}


nss 05-01-2012 05:14 AM

Changing WSDL = recreate axis java client?
 
Hi guys,

I know this is an old thread, but I am stuck with the same problem.
Could someone please elaborate this solution in more detail?

Regards,
NS

Quote:

Originally Posted by blazer (Post 3032611)
Hi all,

This is in response to the posting I've seen regarding AXIS and web
services client libaries blowing up when a WSDL document changes.

Basically the error occurs because a mapping does not exist between an
entry in the WSDL document and your client class. Modifying the
client class as follows will prevent this error from being thrown.

Here's what I had to do to fix the issue:

1) Create a class that extends
org.apache.axis.encoding.ser.BeanDeserializer.
a) Create constructors that basically pass the parameters to the
super class.
b) Override the following method as follows:
@Override
public SOAPHandler onStartChild(String arg0, String arg1, String
arg2, Attributes arg3, DeserializationContext arg4) throws
SAXException {
// TODO Auto-generated method stub
try{
return super.onStartChild(arg0, arg1, arg2, arg3, arg4);
}catch (SAXException e){
return null;
}
}
2) Find the object that is being returned from the web service -
(client class).
a) Override the following method as follows:
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer
getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return new BigYDeserializer(_javaType, _xmlType, typeDesc);

//new org.apache.axis.encoding.ser.BeanDeserializer(
// _javaType, _xmlType, typeDesc);
}



All times are GMT. The time now is 10:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.