Issue with web services clients blowing up if WSDL changes
1) An 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) Note: This is a one time step – no need to repeat - 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:
[FONT=Georgia]
[FONT=Georgia] @Override[/font]
[FONT=Georgia] public SOAPHandler onStartChild(String arg0, String arg1, String arg2, Attributes arg3, DeserializationContext arg4) throws SAXException {[/font]
[FONT=Georgia] // TODO Auto-generated method stub[/font]
[FONT=Georgia] try{[/font]
[FONT=Georgia] return super.onStartChild(arg0, arg1, arg2, arg3, arg4);[/font]
[FONT=Georgia] }catch (SAXException e){[/font]
[FONT=Georgia] return null;[/font]
[FONT=Georgia] }[/font]
[FONT=Georgia] }[/font]
[/FONT]
2) Find the object that is being returned from the web service - (client class).
a) Override the following method as follows:
[FONT=Georgia]
[FONT=Georgia] /**[/font]
[FONT=Georgia] * Get Custom Deserializer[/font]
[FONT=Georgia] */[/font]
[FONT=Georgia] public static org.apache.axis.encoding.Deserializer getDeserializer([/font]
[FONT=Georgia] java.lang.String mechType, [/font]
[FONT=Georgia] java.lang.Class _javaType, [/font]
[FONT=Georgia] javax.xml.namespace.QName _xmlType) {[/font]
[FONT=Georgia] [/font]
[FONT=Georgia]// class from step #1[/font]
[FONT=Georgia]BigYDeserializer d = new BigYDeserializer(_javaType, _xmlType, typeDesc);[/font]
[FONT=Georgia] d.setSilenceOnStartChildExceptions(true);[/font]
[FONT=Georgia] return d; [/font]
[FONT=Georgia] [/font]
[FONT=Georgia] //new org.apache.axis.encoding.ser.BeanDeserializer([/font]
[FONT=Georgia] // _javaType, _xmlType, typeDesc);[/font]
[FONT=Georgia] }[/font]
[/FONT]
#webMethods#soa#API-Management