我用Xfire webservice,客户端调用后,产生的是这样的内容,而我想的是在客户端得到一个javabean对象的。这里必须得自己想办法转吗???
<out xmlns="user" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <ns1:UserInfo xmlns:ns1="http://entity.zhang.com">
    <birthday xmlns="http://entity.zhang.com">123</birthday>
    <email xmlns="http://entity.zhang.com">[email protected]</email>
    <login xmlns="http://entity.zhang.com">123</login>
    <nation xmlns="http://entity.zhang.com">中国</nation>
    <nativeplace xmlns="http://entity.zhang.com">123</nativeplace>
    <pw xmlns="http://entity.zhang.com">123</pw>
    <sex xmlns="http://entity.zhang.com">1</sex>
    <telephone xmlns="http://entity.zhang.com">12345678</telephone>
    <userid xmlns="http://entity.zhang.com">1</userid>
    <username xmlns="http://entity.zhang.com">123</username>
  </ns1:UserInfo>
</out>

解决方案 »

  1.   

    那岂不是很麻烦的??
    那Xfire webservice 也没怎么好用啊??
    我在网上看到很多的例子,感觉都是有问题,他们根本上没有分布在2个应用上测试,要么就是把这个应用给打包放到那个应用那边。哎,高手,教教怎么做吧!!!!!
      

  2.   

    我是这样调用的serviceModel = serviceFactory.create(IWorkService.class);
    workService = (IWorkService) proxyFactory.create(serviceModel,
    "http://" + serverIp + ":" + serverPort
    + "/bookmgrs/service/IWorkService");workService就是服务接口
      

  3.   

    我是这样调用的serviceModel = serviceFactory.create(IWorkService.class);
    workService = (IWorkService) proxyFactory.create(serviceModel,
    "http://" + serverIp + ":" + serverPort
    + "/bookmgrs/service/IWorkService");workService就是服务接口
      

  4.   

    去我博客看看???
    http://blog.csdn.net/kj_zx19854/archive/2008/12/19/3560908.aspx
    看不到图片的话。发邮件我发文档给你[email protected]
      

  5.   


    <out xmlns="user" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
      <ns1:UserInfo xmlns:ns1="http://entity.zhang.com"> 
        <birthday xmlns="http://entity.zhang.com">123 </birthday> 
        <email xmlns="http://entity.zhang.com">[email protected] </email> 
        <login xmlns="http://entity.zhang.com">123 </login> 
        <nation xmlns="http://entity.zhang.com">中国 </nation> 
        <nativeplace xmlns="http://entity.zhang.com">123 </nativeplace> 
        <pw xmlns="http://entity.zhang.com">123 </pw> 
        <sex xmlns="http://entity.zhang.com">1 </sex> 
        <telephone xmlns="http://entity.zhang.com">12345678 </telephone> 
        <userid xmlns="http://entity.zhang.com">1 </userid> 
        <username xmlns="http://entity.zhang.com">123 </username> 
      </ns1:UserInfo> 
    </out>这个是我客户端去得的一组数据,也就是一个完整的用户信息,现在我想取其中的email,
    我用的dom4j来解析这个xml数据。
    可是我发现在取这个元素“ns1:UserInfo”的时候,始终不行,而如果我把他改为"UserInfo"或是其它的,只要不是有分割符的都可以,请问该怎么解决啊,也就是xml中的元素有分隔符该怎么处理????
     
      

  6.   

    两个方法:
    1、使用xml的话,需要确定数据邦定技术,常用的有xmlbeans、jaxb等等,然后客户端使用相同的邦定技术即可
    2、(推荐)使用json,服务器端对数据使用json封装,然后在客户端通过json解析并于javabean映射即可。这样做的好处是json提供多语言支持,xml的数据邦定在跨语言处理的时候会有些麻烦。
      

  7.   

       你到“http://blog.csdn.net/stoneyang2005/archive/2009/02/26/3939117.aspx”看一下,《使用Xfire从WSDL生成客户端(详)》这是我前些天公司没事写的,这个就是通过wsdl生成客户端,自动生成相关的bean供你使用的,如果看不懂,请留言。