请帮我看看调用webservice的问题谢谢!

zhangbo198294
05-04-26 1 221

麻烦帮我看看这个问题好吗? 我的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)
请问我哪出错了啊??

zhangbo198294
2005-04-27 10:18

自己解决了