返回值解析的问题

View: New views
9 Messages — Rating Filter:   Alert me  

返回值解析的问题

by seal_hu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

  碰到个奇怪的问题,调试了好久实在没办法,向大家求教。
  我们是通过客户发布的wsdl用wsdl2java生成客户端代码去调客户的webservice。调用过程中没有异常,用截包工具也可以看到
http response里面的内容确实是我们想要的,但是cxf就是没法把http response里面的内容转换成java对象。

   OSSApiServicePublisher publisher=new OSSApiServicePublisher();
   OSSApiService ossapi=publisher.getOSSApiService();
   GetLoginResponse response=ossapi.getLogin(request);

  这里response里面的属性始终是空的。 后来调试cxf和jaxb的源代码发现jaxb已经被调用了,而且传进去的参数确实是从http
response里面取到的值,好像是jaxb unmarshall 的时候除了问题。但是再往下就没法跟下去了。按理说自动生成的代码不应该会有问
题啊。
  不知道有没有人碰到过类似的问题,或者能给点思路,非常感谢。

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by willem.jiang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

你用的CXF 的版本是什么, response的xml是什么样的, 还有你的JDK版本是什么。
如果想验证这是JAXB的问题,你可以自己写一个小段代码调用JAXB 来处理你的response xml来验证。

姜宁 (Willem)
------------------
Apache CXF, Apache Camel committer
http://willemjiang.blogspot.com/
http://www.fusesource.org

On 8月23日, 上午11时35分, seal_hu <hu.ying...@...> wrote:

>   碰到个奇怪的问题,调试了好久实在没办法,向大家求教。
>   我们是通过客户发布的wsdl用wsdl2java生成客户端代码去调客户的webservice。调用过程中没有异常,用截包工具也可以看到
> http response里面的内容确实是我们想要的,但是cxf就是没法把http response里面的内容转换成java对象。
>
>    OSSApiServicePublisher publisher=new OSSApiServicePublisher();
>    OSSApiService ossapi=publisher.getOSSApiService();
>    GetLoginResponse response=ossapi.getLogin(request);
>
>   这里response里面的属性始终是空的。 后来调试cxf和jaxb的源代码发现jaxb已经被调用了,而且传进去的参数确实是从http
> response里面取到的值,好像是jaxb unmarshall 的时候除了问题。但是再往下就没法跟下去了。按理说自动生成的代码不应该会有问
> 题啊。
>   不知道有没有人碰到过类似的问题,或者能给点思路,非常感谢。
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by seal_hu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


非常感谢你的答复。我用的cxf 2.2.3
response xml:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:th="http://toolhost.corp.chartercom.com/ossapi">
<OSSResponse>
<th:logins>
<th:loginsItem><th:accountNumber>5551111222233334</
th:accountNumber><th:domain>charter.net</th:domain><th:role>PARENT</
th:role><th:status>EXPIRED</th:status><th:system>email</
th:system><th:username>xyotl@...</th:username></
th:loginsItem><th:loginsItem><th:accountNumber>5551111222233334</
th:accountNumber><th:contactEmail>xyotl_second@...</
th:contactEmail><th:domain/><th:role/><th:secQuestion>Favorite movie?</
th:secQuestion><th:status>NONPAY SUSPEND AGING</
th:status><th:system>member services</
th:system><th:username>xyotl_second</th:username></th:loginsItem>
</th:logins>
<th:returnCode>0</th:returnCode>
<th:returnString>Success</th:returnString>
<th:roundTrip>0.896999</th:roundTrip>
</OSSResponse>
</soap:Body>
</soap:Envelope>

jdk 1.5.10
jaxb 简单试了一下,还是不行,不过jaxb还不太会用。

我怀疑是wsdl2java 生成的的code有问题。

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by Qianqian's lover :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

大家有没有人用过JBOSS5集成的CXF,所谓的JBOSSWS-CXF框架,我原本JBOSS4.xx下跑得很好的服务,迁移到JBOSS5上就不能部署了,报乱七八糟甚至不相关的错误。

有没有人有JBOSS5下的webService 的成功经验分享,谢了先!

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by willem.jiang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


很奇怪你的<OSSResponse> 怎么没有 namespace?
你这个response 是CXF 生成的吗?

姜宁 (Willem)
------------------
Apache CXF, Apache Camel committer
http://willemjiang.blogspot.com/
http://www.fusesource.com

On 8月24日, 下午3时34分, seal_hu <hu.ying...@...> wrote:

> 非常感谢你的答复。我用的cxf 2.2.3
> response xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body xmlns:th="http://toolhost.corp.chartercom.com/ossapi">
> <OSSResponse>
> <th:logins>
> <th:loginsItem><th:accountNumber>5551111222233334</
> th:accountNumber><th:domain>charter.net</th:domain><th:role>PARENT</
> th:role><th:status>EXPIRED</th:status><th:system>email</
> th:system><th:username>xy...@...</th:username></
> th:loginsItem><th:loginsItem><th:accountNumber>5551111222233334</
> th:accountNumber><th:contactEmail>xyotl_sec...@...</
> th:contactEmail><th:domain/><th:role/><th:secQuestion>Favorite movie?</
> th:secQuestion><th:status>NONPAY SUSPEND AGING</
> th:status><th:system>member services</
> th:system><th:username>xyotl_second</th:username></th:loginsItem>
> </th:logins>
> <th:returnCode>0</th:returnCode>
> <th:returnString>Success</th:returnString>
> <th:roundTrip>0.896999</th:roundTrip>
> </OSSResponse>
> </soap:Body>
> </soap:Envelope>
>
> jdk 1.5.10
> jaxb 简单试了一下,还是不行,不过jaxb还不太会用。
>
> 我怀疑是wsdl2java 生成的的code有问题。
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by seal_hu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

我们是用cxf做客户端的,服务端应该不是cxf。但是客户端的代码是用cxf的wsdl2java生成的,生成的过程中也没有报错。对比我们现在得到
的response和一个标准的用cxf做服务端生成的response,结构好像是有点不一样。所以我怀疑cxf是不是对其它框架的服务端都能支持的
很好。
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by willem.jiang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

这不是CXF的问题, 是服务器端的问题。
服务器端生成的response 是错误的, CXF没法正确解析。
建议查一下服务器的代码,看看为啥把 <OSSResponse> 的 default namespace给丢掉了。

姜宁 (Willem)
------------------
Apache CXF, Apache Camel committer
http://willemjiang.blogspot.com/
http://www.fusesource.com

On 8月25日, 上午9时46分, seal_hu <hu.ying...@...> wrote:
> 我们是用cxf做客户端的,服务端应该不是cxf。但是客户端的代码是用cxf的wsdl2java生成的,生成的过程中也没有报错。对比我们现在得到
> 的response和一个标准的用cxf做服务端生成的response,结构好像是有点不一样。所以我怀疑cxf是不是对其它框架的服务端都能支持的
> 很好。
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by willem.jiang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

你这问题问得有点不明不白。
首先是你CXF的版本是什么, 还有你是如何部署的,还有就是具体错误是什么?
从你的描述来看,可能是你的War包中包含CXF自带的jar 和 JBOSS5有冲突,

姜宁 (Willem)
------------------
Apache CXF, Apache Camel committer
http://willemjiang.blogspot.com/
http://www.fusesource.com

On 8月24日, 下午5时10分, Bryan X <bryan.xu2...@...> wrote:
> 大家有没有人用过JBOSS5集成的CXF,所谓的JBOSSWS-CXF框架,我原本JBOSS4.xx下跑得很好的服务,迁移到JBOSS5上就不能部署了 ,报乱七八糟甚至不相关的错误。
> 有没有人有JBOSS5下的webService 的成功经验分享,谢了先!
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 返回值解析的问题

by Chris-628 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

是不是WSDL里就没有给对namespace

2009/8/25 willem <willem.jiang@...>
这不是CXF的问题, 是服务器端的问题。
服务器端生成的response 是错误的, CXF没法正确解析。
建议查一下服务器的代码,看看为啥把 <OSSResponse> 的 default namespace给丢掉了。

姜宁 (Willem)
------------------
Apache CXF, Apache Camel committer
http://willemjiang.blogspot.com/
http://www.fusesource.com

On 8月25日, 上午9时46分, seal_hu <hu.ying...@...> wrote:
> 我们是用cxf做客户端的,服务端应该不是cxf。但是客户端的代码是用cxf的wsdl2java生成的,生成的过程中也没有报错。对比我们现在得到
> 的response和一个标准的用cxf做服务端生成的response,结构好像是有点不一样。所以我怀疑cxf是不是对其它框架的服务端都能支持的
> 很好。




--
Best Regards

Chris Cui
--------------------------------------------------------------
Mobile : 13560210207
Email  : askcuix@...
MSN   : askcuix@...

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---