I am a newbie of Web service doing a project about it. Within this topic, I need to retrive data from a database with JDBC then offer a web service. My JDBC program works well and saves all results into a Vector. So I orginally think a simple server programe which invokes the JDBC programe and return Vector to client will finish the project. Unfortuantely, when the client invokes WebService programe, it gives the following exception:
java.lang.reflect.InvocationTargetException at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169) at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationC ontextImpl.java:1015) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher .dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContex tImpl.java:242) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538) at org.apache.axis.Message.getSOAPEnvelope(Message.java:376) at org.apache.axis.client.Call.invokeEngine(Call.java:2583) at org.apache.axis.client.Call.invoke(Call.java:2553) at org.apache.axis.client.Call.invoke(Call.java:2248) at org.apache.axis.client.Call.invoke(Call.java:2171) at org.apache.axis.client.Call.invoke(Call.java:1691) at SoapTest.main(SoapTest.java:15)
java.lang.reflect.InvocationTargetException at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169) at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationC ontextImpl.java:1015) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher .dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContex tImpl.java:242) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538) at org.apache.axis.Message.getSOAPEnvelope(Message.java:376) at org.apache.axis.client.Call.invokeEngine(Call.java:2583) at org.apache.axis.client.Call.invoke(Call.java:2553) at org.apache.axis.client.Call.invoke(Call.java:2248) at org.apache.axis.client.Call.invoke(Call.java:2171) at org.apache.axis.client.Call.invoke(Call.java:1691)
The source code of both server side and client side are listed as below:
Server: public Vector homologyQuery(String gID) throws FileException,DatabaseException { Initialize i=new Initialize(); //reading a configure file DBService db=new DBService(i); gIDs=db.queryGID(gID);
return gIDs ; }
Client:
try { String endpoint = "http://localhost:8080/test/services/HomolougeQueryService"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName(new QName("http://HomolougeQueryService", "homologyQuery")); Vector res = (Vector) call.invoke( new Object[] { args[0]} ); System.out.println("Now the Vector size is :" +res.size()); for (int i=0;i<res.size();i++ ) { System.out.println(res.elementAt(i)); } } catch (Exception e) { e.printStackTrace(); } }
Could help me figure out the problem or give me any hits.