XFire容易配置出现的几个异常信息

来源:互联网 发布:linux stat函数 编辑:程序博客网 时间:2024/05/16 06:56

今天做一个Flex调用Web服务的程序创建一个WS,由于一段时间没有使用配置忘记,导致发生一个错误,经过研究发现时配置错误:所以修改配置发现常出现错误!!如下希望可以给各个编程爱好者一个帮助!^_^

 

 

 

发生以下错误的原因:

Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault:

Illegal argument invoking 'com.unutrip.remoting.ws.FlexWebService.helloWord(java.lang.String, java.lang.String)': object is not an instance of declaring

class
org.codehaus.xfire.fault.XFireFault: Illegal argument invoking 'com.unutrip.remoting.ws.FlexWebService.helloWord(java.lang.String, java.lang.String)': object

is not an instance of declaring class
 at org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
 at org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
 at org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
 at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
 at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
 at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
 at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
 at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
 at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
 at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
 at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
 at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
 at org.codehaus.xfire.client.Client.invoke(Client.java:336)
 at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
 at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
 at $Proxy0.helloWord(Unknown Source)
 at com.unutrip.xfire.ws.XFireWSClient.main(XFireWSClient.java:30)

 

经过一番分析和检得到是xfire.xml的配置文件错误!!

 

错误配置如下:

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
 <service>
  <name>FlexWebService</name>
  <namespace>com.unutrip.remoting.ws</namespace>
  <serviceClass>
  com.unutrip.remoting.ws.FlexWebService
  </serviceClass>
  <serviceBean>com.unutrip.remoting.ws.FlexWebServiceImpl</serviceBean>
 </service>
</beans>

 

正确配置:

 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
 <service>
  <name>FlexWebService</name>
  <namespace>com.unutrip.remoting.ws</namespace>
  <serviceClass>com.unutrip.remoting.ws.FlexWebService</serviceClass>
  <implementationClass>com.unutrip.remoting.ws.FlexWebServiceImpl</implementationClass>
 </service>
</beans>


发生以下错误:
Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault:

Invalid operation: {http://ws.remoting.unutrip.com}helloWord
org.codehaus.xfire.fault.XFireFault: Invalid operation: {http://ws.remoting.unutrip.com}helloWord
 at org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
 at org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
 at org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
 at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
 at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
 at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
 at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
 at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
 at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
 at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
 at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
 at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
 at org.codehaus.xfire.client.Client.invoke(Client.java:336)
 at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
 at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
 at $Proxy0.helloWord(Unknown Source)
 at com.unutrip.xfire.ws.XFireWSClient.main(XFireWSClient.java:30)

 

错误配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
 <service>
  <name>FlexWebService</name>
  <namespace>com.unutrip.remoting.ws</namespace>
  <serviceBean>com.unutrip.remoting.ws.FlexWebService</serviceBean>

<serviceClass>com.unutrip.remoting.ws.FlexWebService</serviceClass>
  <implementationClass>com.unutrip.remoting.ws.FlexWebServiceImpl</implementationClass>
 </service>
</beans>

 


正确配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
 <service>
  <name>FlexWebService</name>
  <namespace>com.unutrip.remoting.ws</namespace>
  <serviceClass>com.unutrip.remoting.ws.FlexWebService</serviceClass>
  <implementationClass>com.unutrip.remoting.ws.FlexWebServiceImpl</implementationClass>
 </service>
</beans>

原创粉丝点击