請幫我看看呼叫webservice的問題謝謝!

zhangbo198294發表於2005-04-26
麻煩幫我看看這個問題好嗎? 我的webservice寫的是個hibernate的操作 呼叫的時候就出錯了

web service:
public class TestCat {
static Configuration cfg=null;
static SessionFactory sessionsFactory=null;
static Session session =null;
static Transaction tx=null;
//插入
public static void insertCat(String name,String sex) {

try {
cfg = new Configuration().addClass(Cat.class);
sessionsFactory = cfg.buildSessionFactory();
session = sessionsFactory.openSession();

Cat cat_obj=new Cat();
cat_obj.setName(name);
cat_obj.setSex(sex);
tx = session.beginTransaction();
session.save(cat_obj);
tx.commit();
session.close();
}catch (Exception e) {
e.printStackTrace();
}
}

}

呼叫程式:
String name="Admin";
String sex="男";
String endpoint="http://127.0.0.1:8080/axis/services/sqlservice?wsdl";;
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName(new QName("urn:sqlservice","insertCat"));
call.addParameter(name, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING );
call.addParameter(sex, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING );
call.invoke(new Object[]{name,sex});

出錯資訊:
- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.reflect.InvocationTargetException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:zhangbo-0jqg54b

java.lang.reflect.InvocationTargetException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSdocument.cannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLdocument.ragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLdocument.ragmentScannerImpl.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(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at org.apache.axis.client.Call.invoke(Call.java:2737)
at org.apache.axis.client.Call.invoke(Call.java:2413)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at mypack.HelloClient.main(HelloClient.java:58)
請問我哪出錯了啊??

相關文章