我在一个main中运行如下代码:
URL wsdlURL = new URL("
http://localhost:8080/service/
TollFreeNumberService?wsdl");
DynamicClientFactory dcf = DynamicClientFactory.newInstance
();
Client client = dcf.createClient(wsdlURL);
Object[] objArray = new Object[1];
objArray[0] = "";
objArray[1] = "";
objArray[2] = "4001202990";
//调用特定的Web Service方法
Object[] results = client.invoke("getNumber", objArray);
System.out.println(results[0]);
如下错误:
2009-11-03 10:41:10,187
[org.apache.cxf.bus.spring.BusApplicationContext]-[INFO] Refreshing
org.apache.cxf.bus.spring.BusApplicationContext@f62373: display name
[org.apache.cxf.bus.spring.BusApplicationContext@f62373]; startup date
[Tue Nov 03 10:41:10 CST 2009]; root of context hierarchy
2009-11-3 10:41:10 org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
信息: No cxf.xml configuration file detected, relying on defaults.
2009-11-03 10:41:10,484
[org.apache.cxf.bus.spring.BusApplicationContext]-[INFO] Bean factory
for application context
[org.apache.cxf.bus.spring.BusApplicationContext@f62373]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@1e152c5
Exception in thread "main" java.lang.IllegalStateException: Unable to
create schema compiler
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient
(DynamicClientFactory.java:264)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient
(DynamicClientFactory.java:231)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient
(DynamicClientFactory.java:224)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient
(DynamicClientFactory.java:159)
at com.m800.i400.pboss.nummanage.ws.impl.Test.main(Test.java:83)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:
90)
Caused by: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.tools.internal.xjc.api.XJC]
at org.apache.cxf.jaxb.JAXBUtils.createSchemaCompiler(JAXBUtils.java:
622)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient
(DynamicClientFactory.java:262)
... 9 more
Caused by: java.lang.ClassNotFoundException:
com.sun.tools.internal.xjc.api.XJC
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.cxf.jaxb.JAXBUtils.createSchemaCompiler(JAXBUtils.java:
615)
... 10 more
cxf不能Dynamic Client方式调用吗?