未知数据

从头看Java

   ::  :: 联系 :: 聚合  :: 管理
  28 Posts :: 0 Stories :: 10 Comments :: 0 Trackbacks

最近根据wsdl文件生成客户端代码,使用MyEclipse的xfire和axis插件都报错,报错如截图;

 

后来在网上搜,原因应该是服务端发布的时候使用的是axis1.2版本的,使用的版本过低.于是从网上下载了axis1.2的版本,再试,还是一样报错.


报错信息如下:
<Recharge xmlns="ocs/server">
  <in0 xmlns="">
    <requestId>20090728000022</requestId>
    <requestTime>20081102000000</requestTime>
    <destinationId>13340011829</destinationId>
    <destinationAttr>2</destinationAttr>
    <balanceType>2000</balanceType>
    <rechargeUnit>0</rechargeUnit>
    <objType>5BC</objType>
    <rechargeAmount>10</rechargeAmount>
    <requestAmount>1</requestAmount>
    <cardNumber/>
    <channelID/>
    <operSystem/>
  </in0>
</Recharge>
java.lang.NullPointerException
        at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteDefaultNs(BaseNsStreamWriter.java:528)
        at com.ctc.wstx.sw.SimpleNsStreamWriter.writeDefaultNamespace(SimpleNsStreamWriter.java:111)
        at com.ctc.wstx.sw.SimpleNsStreamWriter.writeNamespace(SimpleNsStreamWriter.java:119)
        at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeNamespace(MTOMXMLStreamWriter.java:146)
        at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(StreamingOMSerializer.java:243)
        at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:76)
        at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:59)
        at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:473)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:823)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:848)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:819)
        at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:180)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:848)
        at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:419)
        at org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput(SOAPOverHTTPSender.java:190)
        at org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:232)
        at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
        at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:541)
        at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
        at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
        at com.huawei.bus.ws.ct.skeleton.UvcSoapForOcsServiceStub.Recharge(UvcSoapForOcsServiceStub.java:266)
        at test.Test.main(Test.java:56)

  把报错的测试工程发到同事那里测试,一切正常.
  最后只好从同事那里
发过来axis的jar包导入,最后正常.

  怀疑是axis版本不一样,用比较工具比较两个lib文件夹,果然axis的版本不一样.

 

  用org.apache.axis2.Version.getVersionText() 返回版本号,一个是1.1,一个是1.1.1(才发现axis2的2不是版本号...).

  之前一直都用xfire,好像没有遇到过服务端和客户端版本不一致还会有问题.看来还是要慎用axis.

posted on 2009-08-17 10:46 wangjc 阅读(3988) 评论(3)  编辑  收藏 所属分类: workspace

Feedback

# re: wsdl文件生成客户端代码问题 2010-05-21 15:44 谢康林
你好,我出现了和你相同的问题,想咨询下你具体的解决方法。我的QQ:285843912,看到了留言后加我,感激不尽啊!  回复  更多评论
  

# re: wsdl文件生成客户端代码问题 2010-05-21 18:24 wangjc0801
@谢康林
这个是很久以前弄的了,原因就是axis的版本不对,最后保持服务端和客户端的版本一致,应该就没问题了.希望能帮到你  回复  更多评论
  

# re: wsdl文件生成客户端代码问题[未登录] 2012-04-17 22:07
你好,我出现了和你相同的问题,想咨询下你具体的解决方法。我的邮箱471607572@qq.com,看到了把jar包发到邮箱,感激不尽啊!

  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: