請幫我看看呼叫webservice的問題謝謝!
麻煩幫我看看這個問題好嗎? 我的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)
請問我哪出錯了啊??
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)
請問我哪出錯了啊??
相關文章
- 各位高手來幫我看看sql的問題吧,謝謝啦,線上等答案啊SQL
- jive配置中的database問題?!請幫忙阿謝謝!Database
- 安裝是遇到錯誤,大家幫我看看,謝謝
- 請求幫助!謝謝!
- 板橋及各位高手,幫我看看遠端呼叫這個難題,非常感謝。
- 來幫我看看這個簡單的遠端客戶端呼叫EJB出錯的例子,謝謝了客戶端
- 請大家幫忙,關於儲存過程分頁的問題...謝謝儲存過程
- 關於資料庫的問題。請幫忙看下,在下先謝謝了資料庫
- benq大哥,幫忙,請進入,謝謝!ENQ
- activemq的問題,謝謝MQ
- 請教彭老師關於jdbc的問題,謝謝!JDBC
- 請教tomcat連線sqlserver的問題!!謝謝各位!TomcatSQLServer
- 幫忙看看如何設定,跪謝!
- Tomcat服務問題,Cpu100%,急需幫助,請高手指點,謝謝!!!Tomcat
- 請教關於jive原始碼,請各位高手幫忙 ,謝謝!!!原始碼
- 請教問題:jive1.2.4資料庫連線問題,謝謝資料庫
- BEANS使用LOOKUP()呼叫的時候返回物件的問題???(先謝謝了)Bean物件
- 請問java行集如何理解,哪裡有較詳細的幫助?謝謝Java
- 關於SimpleJdonFrameworkTest的問題,謝謝!Framework
- 遠端呼叫EJB。報錯如下。請問是什麼原因?請教banq等dx。謝謝!
- jms的問題,請高手幫忙解決一下,先謝了
- 關於petstore的執行問題,謝謝~
- 測試問題思考,有些問題我自己有答案,但是我想聽聽大家的見解,謝謝!
- 安裝jive3.1.5問題,謝謝
- 請各位高人幫我指點一下我的職業規劃!謝謝了!(5年多工作經驗)
- Struts +Spring + Hibernate 的配置問題,謝謝!Spring
- 在weblogic中配置mysql的連線池的問題??希望大家進來看看了,謝謝了WebMySql
- 關於mysql和jsp的中文問題~謝謝MySqlJS
- Oracle在UNIX上實施的新書就要面市,還請大家幫忙看看,書名怎麼定合適?謝謝大家!Oracle新書
- 關於jsp拒絕訪問的問題,謝謝大家JS
- 請問這個報錯該怎麼解決,謝謝
- 有關工作流程的概念,用法的問題!謝謝
- 一個關於mysql方面的問題,希望斑竹和大家能幫忙,謝謝!!MySql
- 請高人幫我看看webwork使用Validator驗證的問題Web
- 我下載新的論壇,安裝出現錯誤,誰幫我解決下,謝謝
- 請各位給我指路:請問要學習J2EE我需要學習那些方面的東西?謝謝了
- 有關javaAPI,請各位高手幫忙,拜謝JavaAPI
- 請bang老師幫我看下這樣說面向服務和麵向物件的關係是否正確,謝謝物件