xfire 生成webservice客户端,调用时的问题

bluesky85 2009-07-02 01:48:48
在myeclipse中使用xfire生成webservice客户端,传入参数、返回的结果参数都是类对象,可是在执行的时候却报以下错误:

Invoking handler org.codehaus.xfire.client.ClientReceiveHandler in phase service
Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Could not unmarshall type : com.xxx.xxx.xxx.xxxResponse is not known to this context
org.codehaus.xfire.fault.XFireFault: Could not unmarshall type : com.xxx.xxx.xxx.xxxResponse is not known to this context
at org.codehaus.xfire.jaxb2.JaxbType.readObject(JaxbType.java:219)
at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:169)
at org.codehaus.xfire.service.binding.RPCBinding.readMessage(RPCBinding.java:91)
at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
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 $Proxy12.buyBatchProduct(Unknown Source)
at com.xxx.xxx.xxx.impl.CBuyClubHandler.buyProduct(CBuyClubHandler.java:220)
at com.xxx.xxx.xxx.impl.CBuyClubHandler.main(CBuyClubHandler.java:235)
Caused by: javax.xml.bind.JAXBException: com.cnfol.webservice.product.BuyProductResponse is not known to this context
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:510)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getBeanInfo(UnmarshallerImpl.java:502)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:316)
at org.codehaus.xfire.jaxb2.JaxbType.readObject(JaxbType.java:201)
... 17 more


哪位兄弟知道怎么解决这个问题的?谢谢!
...全文
328 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
huihuirinka 2011-06-18
  • 打赏
  • 举报
回复
这到底是什么原因啊
yztommyhc 2009-07-02
  • 打赏
  • 举报
回复
com.cnfol.webservice.product.BuyProductResponse is not known to this context

这个Response是否正确,应该是这里的问题。
mydeman 2009-07-02
  • 打赏
  • 举报
回复
代码拿来看看。

传入的参数应该使用ObjectFactory赋值,返回值应该也需要使用它。
目录....................................................................................................................................................2 说明....................................................................................................................................................3 一、使用到的开发工具:.........................................................................................................3 二、服务端开发步骤.................................................................................................................3 1、使用xfire 创建Web 服务。..............................................................................................3 2、创建服务接口和实现.........................................................................................................7 3、xfire 服务配置....................................................................................................................9 4、服务发布...........................................................................................................................10 5、为服务配置安全认证.......................................................................................................11 三、客户端开发.......................................................................................................................12 1、新建Web 工程................................................................................................................. 12 2、导入xfire 包.....................................................................................................................13 3、创建类定义.......................................................................................................................15 四、扩展1-使用xfire 插件创建客户端代码........................................................................ 18 1、插件安装.............................................................................................................................18 2、使用已安装的插件进行客户端代码生成........................................................................ 20 4、编写调用代码,调用服务.............................................................................................. 24 五、扩展2-使用axis(这是1-4 版本)创建客户端代码.................................................... 28 1、使用WSDL2Java 工具根据WSDL 生成客户端代码.................................................. 28 2、新建工程项目...................................................................................................................30 3、编写调用代码...................................................................................................................31

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧