我尝试通过以下方式从 Web 服务中获取结果。
List result = new Vector();
LibrarySearchRequest request = new LibrarySearchRequest(queryString);
LibrarySearchServicePortTypeProxy proxy =
new LibrarySearchServicePortTypeProxy();
LibrarySearchServicePortType port = proxy.getLibrarySearchServicePortType();
LibrarySearchResponse response = port.process(request);
librarysearch.soft.Book[] books = response.getBooks();
当我这样做时,我得到以下异常(stacktrace):
org.xml.sax.SAXException: Invalid element in librarysearch.soft.Book - book
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at librarysearch.soft.LibrarySearchServiceSOAP11BindingStub.process(LibrarySearchServiceSOAP11BindingStub.java:180)
at softarch.portal.db.ws.WS_RegularDatabase.findRecords(WS_RegularDatabase.java:44)
at softarch.portal.db.test.TestWSRegularDatabase.main(TestWSRegularDatabase.java:39)
The regular database has caught an unexpected exception: ; nested exception is:
org.xml.sax.SAXException: Invalid element in librarysearch.soft.Book - book
我读到问题可能是由于从 web 服务返回的结果与从 wsdl 生成的类不匹配引起的。我重新生成了我的 web 服务客户端,但没有成功。还有什么问题?