2 gk1193134640 gk1193134640 于 2014.05.29 14:03 提问

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个回答

xmt1139057136
xmt1139057136   Rxr 2016.01.23 13:45
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!