深渊之怒 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 镍氢电池充电器设计实物使用原理
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号