Webservice客户端调用服务端时,服务端一直报错

这个是服务端报错信息:
十一月 18, 2016 2:19:39 下午 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
警告: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:148)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:83)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:114)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:98)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:452)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:196)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:220)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.service(AbstractCXFServlet.java:211)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hyjx.framework.interceptor.XSSFilter.doFilter(XSSFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.hyjx.framework.service.Ddzh_hdxxWebServiceImpl.getOneZhiXingAjxx(Ddzh_hdxxWebServiceImpl.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
... 35 more
下面是客户端调用时的方法(客户端现在不能修改只能改服务端):/**
* 执行远程调用,单例模式调用
*
* @param url
* wsdl URL
* @param invokeFunc
* 调用方法
* @param objArray
* 参数
* @return
* @throws Exception
/
public static String remoteCall(String url, String invokeFunc,
Object... param) {
Client client = null;
ClientPool pool = ClientPool.getInstance(url);
LOGGER.debug("执行webservice使用参数:" + Arrays.toString(param));
LOGGER.debug("执行webservice调用方法:" + invokeFunc);
try {
client = pool.get();
if (null == client) {
return CONNECT_TIMED_OUT;
}
return executeRemoteCall4String(client, invokeFunc, param);
} catch (Exception e) {
LOGGER.error("执行webservice调用失败,尝试重新初始化客户端后调用", e);
pool.destory(client);
client = pool.get();
try {
return executeRemoteCall4String(client, invokeFunc, param);
} catch (Exception e1) {
LOGGER.error("error ro invoke function: " + invokeFunc
+ ", where remote call url=" + url + " and params:"
+ Arrays.toString(param));
}
} finally {
pool.reuse(client);
}
return null;
}

/
*
* 用指定客户端执行远程调用
*
* @param Client
* Client
* @param invokeFunc
* 调用方法
* @param objArray
* 参数
* @return
* @throws Exception
*/
private static String executeRemoteCall4String(Client client,
String invokeFunc, Object[] objArray) throws Exception {
if (client == null) {
return null;
}
Object[] results = client.invoke(invokeFunc, objArray);
if (results != null && results.length > 0) {
String resultStr = (String) results[0];
LOGGER.debug("执行webservice返回结果:" + resultStr);
return resultStr;
}
return null;
}

2个回答

你这个得看服务端的方法吧

服务端就是最普通的CXF服务端,别的方法都没问题就这一个方法有问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问