当前位置: 代码迷 >> Eclipse >> xfire 开发 webservice,该如何处理
  详细解决方案

xfire 开发 webservice,该如何处理

热度:257   发布时间:2016-04-23 15:04:16.0
xfire 开发 webservice
package   com.ajtrafficsms.trafficdb;
import   java.net.MalformedURLException;
import   org.codehaus.xfire.XFire;
import   org.codehaus.xfire.XFireFactory;
import   org.codehaus.xfire.client.XFireProxyFactory;
import   java.net.URL;
import   org.codehaus.xfire.client.Client;

import   com.ajtrafficsms.util.*;
/**
  *   调用GWJ   webservice的接口
  *   @author   Administrator
  *
  */
public   class   XfireClient   {

public   static   void   main(String   args[]){
getQueryInfo( "GetVehicleInfoFromZongDui ",   new   String[]   { "02 ", "39080 "});
}


public   static   String   getQueryInfo(String   methodName,String[]   para)   {
Client   client   =   null;
String   result= "-1 ";
try   {

      XFire   xfire   =   XFireFactory.newInstance().getXFire();
      XFireProxyFactory   factory   =   new   XFireProxyFactory(xfire);
              client   =   new   Client(new   URL(CfgSys.WebServiceURL4ZD));
              Object[]     oResult     =   client.invoke(methodName,   para);
for(int   i=0;i <oResult.length;i++){
result=   oResult[i].toString();
result=replace(result, "utf-8 ", "gb2312 "   );
    }

}   catch   (Exception   e1)   {
//   TODO   Auto-generated   catch   block
//e1.printStackTrace();
LogManage.ins().severe( "XFire   to   WebService   error:   "+e1);
}
System.out.println( "   Xfire   result   is: "+result);
return   result;
}


private   static   String   replace(String   strSource,   String   strFrom,   String   strTo)   {
java.lang.String   strDest   =   " ";
int   intFromLen   =   strFrom.length();
int   intPos;
while   ((intPos   =   strSource.indexOf(strFrom))   !=   -1)   {
strDest   =   strDest   +   strSource.substring(0,   intPos);
strDest   =   strDest   +   strTo;
strSource   =   strSource.substring(intPos   +   intFromLen);
}
strDest   =   strDest   +   strSource;

return   strDest;
}
}


调试时报错;

Exception   in   thread   "main "   java.lang.NoClassDefFoundError:   org/apache/commons/logging/LogFactory
at   org.codehaus.xfire.transport.DefaultTransportManager. <clinit> (DefaultTransportManager.java:26)
at   org.codehaus.xfire.DefaultXFire. <init> (DefaultXFire.java:37)
at   org.codehaus.xfire.XFireFactory. <init> (XFireFactory.java:34)
at   org.codehaus.xfire.XFireFactory.newInstance(XFireFactory.java:59)
at   com.ajtrafficsms.trafficdb.XfireClient.getQueryInfo(XfireClient.java:59)
at   com.ajtrafficsms.trafficdb.XfireClient.main(XfireClient.java:18)


初步理解;java.lang.NoClassDefFoundError:   org/apache/commons/logging/LogFactory
没有找到,如何解决


------解决方案--------------------
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Mon Dec 18 20:29:28 CST 2017
  • 最近登录:Mon Dec 18 20:29:28 CST 2017
  • 最近登录:Mon Dec 18 20:29:28 CST 2017
  • 最近登录:Mon Dec 18 20:29:28 CST 2017
  • 最近登录:Mon Dec 18 20:29:28 CST 2017