深渊之怒 2014-05-29 06:03 采纳率: 0%
浏览 2078

java cxf调用.net的服务端,报类型不匹配

我有一个wsdl的地址,可以根据这个地址,使用cxf生成对应的java po文件。
但是在使用cxf的动态调用的使用,总是报类型不匹配。
这是我的代码
public static void main(String[] args) {
// TODO Auto-generated method stub
cn.com.webxml.AuthenticationInformation authenticationInformation = new cn.com.webxml.AuthenticationInformation();

cn.com.webxml.ExchangeEventInfo exchangeEventInfo = new cn.com.webxml.ExchangeEventInfo();

cn.com.webxml.Body body = new cn.com.webxml.Body();

javax.xml.ws.Holder genericResult = new javax.xml.ws.Holder();

javax.xml.ws.Holder resultsInfo = new javax.xml.ws.Holder();
callService(
"http://webservice.e6gpshk.com/dzsn/DZSNWebServices.asmx?wsdl",
"QueryVehicleGPSInformation", authenticationInformation,
exchangeEventInfo, body, genericResult, resultsInfo);
}

public static String callService(String wsUrl, String method, Object... arg) {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(wsUrl);
Object[] res = null;
try {
res = client.invoke(method, arg);
} catch (Exception e) {
e.printStackTrace();
}
return (String) res[0];
}

每次运行的时候,都报
信息: Created classes: com.e6gps.AuthenticationInformation, com.e6gps.Body, com.e6gps.ExceptionInfo, com.e6gps.ExchangeEventInfo, com.e6gps.GenericResult, com.e6gps.ObjectFactory, com.e6gps.ProviderInfomation, com.e6gps.Providerlist, com.e6gps.QueryVehicleGPSInformation, com.e6gps.QueryVehicleGPSInformationResponse, com.e6gps.ResultsInfo
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(AbstractWrapperHelper.java:99)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:100)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:340)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at cn.com.webTest.GpsTest7.callService(GpsTest7.java:36)
at cn.com.webTest.GpsTest7.main(GpsTest7.java:25)
2014-5-29 13:48:20 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
警告: Interceptor for {http://www.e6gps.com/}Service_DZSN#{http://www.e6gps.com/}QueryVehicleGPSInformation has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(AbstractWrapperHelper.java:107)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:100)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:340)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at cn.com.webTest.GpsTest7.callService(GpsTest7.java:36)
at cn.com.webTest.GpsTest7.main(GpsTest7.java:25)
org.apache.cxf.interceptor.Fault
at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(AbstractWrapperHelper.java:107)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:100)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:340)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at cn.com.webTest.GpsTest7.callService(GpsTest7.java:36)
at cn.com.webTest.GpsTest7.main(GpsTest7.java:25)
Exception in thread "main" java.lang.NullPointerException
at cn.com.webTest.GpsTest7.callService(GpsTest7.java:40)
at cn.com.webTest.GpsTest7.main(GpsTest7.java:25)

我朝服务端的开发问了一下他的方法,前三个是输入参数,后两个是输出参数。
请问.net的输出参数,我在调用的时候,也要写上么。
但是我后两个参数写上和不写上都试过了,全是报参数不匹配
请问该怎么解决

  • 写回答

1条回答 默认 最新

  • 业余草 科技数码领域优质创作者 2016-01-23 05:45
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置