shaunforbes

Incorrect annotation in SOAP API causing exceptions

Discussion created by shaunforbes on Feb 1, 2015
Latest reply on Oct 12, 2015 by mstaessen

When using the ArcGIS Server SOAP API on Windows using Java 7/8 (works fine on Linux and/or Java 6) I found an issue where the arcgis_agsws_stubs.jar library is throwing an intermittent class cast exception

  com.esri.arcgisws.GetServerInfoFeatureServerResponse cannot be cast to com.esri.arcgisws.GetServerInfoResponse

when calling MapServerBindingStub.getServiceInfo(String mapName) method.

 

 

I tracked the issue down to the GetServiceInfoFeatureServerResponse (and the GetServiceInfoFeatureServer) class having an incorrect @XmlRootElement annotation. They're set to GetServiceInfoResponse (and GetServiceInfo), which I believe is causing JAXB, under certain circumstances, to deserialize the GetServiceInfoResponse returned from the server as a GetServiceInforFeatureServiceResponse.

 

 

The problem appears to be in all versions of the arcgis_agsws_stubs.jar library up to 10.3, and I have no idea why the issue only occurs with using Java 7+ on Windows (I reproduced the problem on both Windows 7 Professional and Windows Server 2012 using Oracle JRE 1.7.0.65 and 1.8.0.31), but I've resolved the problem for myself by manually editing the classes to fix the annotations (using the ClassEditor v 2.23 from classeditor.sourceforge.net) and so far it appears to have resolved the problem.

 

 

So in the vain hope that someone at ESRI notices this post and wants to improve their software I though I'd mention it.

 

 

Cheers,

Shaun

Outcomes