I am trying to create a quick sample Java client for a SOAP web service we have built with ASP.net.
The web service message schema makes use of many abstract classes with implementations of those, e.g. DeviceIdentifier (abstract), with SerialNumber and ProductNumber (these are hypothetical examples to illustrate the question)
I used wsimport to create the client side proxy to consume the web service from my java code:
wsimport -extension -s c:\theservice -d c:\theservice -p theservice http://server/theservice?wsdl
I then assemble the message as follows:
GetDeviceReq request = new GetProductReq(); DeviceIdentifier id = new SerialNumber(); ((SerialNumber)id).setUnitIdentifier(id); GetDeviceResp response = service.GetDevice(request);
The code compiles perfectly and executes. However, I obtain a SOAPFaultException with the following message from the ASP.net web service:
The specified type is abstract: name='DeviceIdentifier', namespace='http://bogus', at <unitIdentifier xmlns='http://bogus'>.
I understand what the error message means, but I am running out of ideas as to why its happening in this case? I suspect it may have something to do with the way the wsimport tool generated the proxy code?