找回密码
 注册成为天翎用户
查看: 945|回复: 4

使用webservice-interface返回值为String报错

[复制链接]
万佳信息 发表于 2016-7-6 09:46:26 | 显示全部楼层 |阅读模式
本帖最后由 myApps 于 2016-7-8 16:59 编辑

使用webservice-interface返回值为String时报错,返回值为int时正常

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册成为天翎用户

×
myApps 发表于 2016-7-6 15:01:13 | 显示全部楼层
这个麻烦把具体的代码发上来看看,估计string转换出错。
回复

使用道具 举报

 楼主| 万佳信息 发表于 2016-7-6 15:52:21 | 显示全部楼层
  1. package webService;

  2. public class SyncTest {

  3.         public static void main(String[] args) {
  4.                 //部门同步
  5.                 String url="http://localhost:8080/obpm/services/DepartmentService";
  6.                 String pk ="11e6-4314-767bf282-a2bd-77e1f101bc4d";
  7.                 String xmlStr = "<cn.myapps.webservice.model.SimpleDepartment>/n"
  8.                                 + " <domainName>万佳信息工程公司</domainName>/n"
  9.                                 + " <id></id>/n"
  10.                                 + " <level></level>/n"
  11.                         + " <name>部门1</name>/n"
  12.                         + " <superiorName>Xml格式部门</superiorName>/n"
  13.                         + " </cn.myapps.webservice.model.SimpleDepartment>/n";
  14.                 XfireClient xfireClient=new XfireClient();
  15.                 xfireClient.createDepartment(url, xmlStr);
  16.                 //xfireClient.getDepartment(url, pk);
  17.                 //xfireClient.updateDepartment(url, xmlStr);
  18.                 //xfireClient.deleteDepartment(url, pk);
  19.                
  20.                
  21.                 //用户同步
  22.                 /*String url="http://127.0.0.1:8080/obpm/services/UserService";
  23.                 String xmlStr="<cn.myapps.webservice.model.SimpleUser>/n"
  24.                                 + "<name>XmlUser</name>/n"
  25.                                 + "<loginno>XmlUser</loginno>/n"
  26.                                 + "<loginpwd>teelink</loginpwd>/n"
  27.                                 + "<domainName>万佳信息工程公司</domainName>/n"
  28.                                 + "<defaultDepartmentName>市场部</defaultDepartmentName>/n"
  29.                                 + "</cn.myapps.webservice.model.SimpleUser>";
  30.                 XfireClient xfireClient=new XfireClient();*/
  31.                

  32.         }

  33. }
复制代码

回复

使用道具 举报

 楼主| 万佳信息 发表于 2016-7-6 16:00:04 | 显示全部楼层
  1. package webService;

  2. import java.net.MalformedURLException;

  3. import org.codehaus.xfire.client.XFireProxyFactory;
  4. import org.codehaus.xfire.service.Service;
  5. import org.codehaus.xfire.service.binding.ObjectServiceFactory;

  6. import test.IAnyName;

  7. public class XfireClient {
  8.        
  9.         public XfireClient(){
  10.         }
  11.        
  12.         public String createDepartment(String url,String xmlStr){
  13.                 try {
  14.                         Service service = new ObjectServiceFactory().create(TLInterface.class) ;  
  15.                                XFireProxyFactory factory = new XFireProxyFactory() ;
  16.                         TLInterface tlInterface = (TLInterface) factory.create(service,url) ;
  17.                            int result=tlInterface.createDepartmentFromXML(xmlStr);
  18.                         } catch (Exception e) {  
  19.                             e.printStackTrace();  
  20.                 }
  21.                 return null;  
  22.         }
  23. }
复制代码
回复

使用道具 举报

 楼主| 万佳信息 发表于 2016-7-8 16:50:02 | 显示全部楼层
暂时只能改源码返回值类型为String,暂时没出问题
回复

使用道具 举报

本版积分规则

手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-13 18:37

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表