axis2 客户端调用webservice出错。
自己单独写一个工程用axis2 调用webservice 成功,但是把jar包拷进一个已有的工程就无法运行。 编译无错。
我现在都无法下手。不知道该如何着手解决问题。哪位大侠有类似经验,提点下吧?给个解决的突入点也好呀。
调用方法(用来发送短信的)
public static void send(String sjhm,String hfdxnr) {
// 使用RPC方式调用WebService
RPCServiceClient serviceClient = null;
try {
serviceClient = new RPCServiceClient();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Options options = serviceClient.getOptions();
// 指定调用WebService的URL
EndpointReference targetEPR = new EndpointReference(getsmsUrl()
);
options.setTo(targetEPR);
Object[] opAddEntryArgs;
String json ="{'APPID':'001','ACCEPTPASSWORD':'1','ACCEPTPHONENUM':'"+sjhm+"','SMSCONTENT': '"+hfdxnr+"'}";
// 指定method方法的参数值
opAddEntryArgs = new Object[] {json};
// 指定method方法返回值的数据类型的Class对象
Class[] classes = new Class[] {String.class};
// 指定要调用的method方法及WSDL文件的命名空间
QName opAddEntry = new QName("http://service.centralsoft.com/", "sendSMS");
// 调用method方法并输出该方法的返回值
options.setAction(" ");
try{
serviceClient.invokeBlocking(opAddEntry, opAddEntryArgs, classes) ;
}catch(Exception e){
e.printStackTrace();
}
}
异常:
java.lang.NoClassDefFoundError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at org.apache.axis2.deployment.AxisConfigBuilder.getPhase(AxisConfigBuilder.java:638)
at org.apache.axis2.deployment.AxisConfigBuilder.processPhaseList(AxisConfigBuilder.java:390)
at org.apache.axis2.deployment.AxisConfigBuilder.processPhaseOrders(AxisConfigBuilder.java:433)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:133)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:615)
at&