服務端:
?1?import?java.util.ArrayList;
?2?import?java.util.List;
?3?import?javax.jws.WebMethod;
?4?import?javax.jws.WebService;
?5?import?javax.jws.soap.SOAPBinding;
?6?
?7?@WebService(targetNamespace?=?"http://jdk.study.hermit.org/testlist")
?8?@SOAPBinding(style?=?SOAPBinding.Style.RPC)
?9?public?class?GetList?{
10?????@WebMethod
11?????public?List<UserInfo>?sayHello(int?n)?{
12?????????List<UserInfo>?userlist?=?new?ArrayList<UserInfo>();
13?????????for?(int?i?=?0;?i?<?n;?i++)?{
14?????????????UserInfo?user?=?new?UserInfo();
15?????????????user.setId(i);
16?????????????user.setName("name"+i);
17?????????????userlist.add(user);
18?????????}
19?????????return?userlist;
20?????}
21?}
啟動時報錯:?2?import?java.util.List;
?3?import?javax.jws.WebMethod;
?4?import?javax.jws.WebService;
?5?import?javax.jws.soap.SOAPBinding;
?6?
?7?@WebService(targetNamespace?=?"http://jdk.study.hermit.org/testlist")
?8?@SOAPBinding(style?=?SOAPBinding.Style.RPC)
?9?public?class?GetList?{
10?????@WebMethod
11?????public?List<UserInfo>?sayHello(int?n)?{
12?????????List<UserInfo>?userlist?=?new?ArrayList<UserInfo>();
13?????????for?(int?i?=?0;?i?<?n;?i++)?{
14?????????????UserInfo?user?=?new?UserInfo();
15?????????????user.setId(i);
16?????????????user.setName("name"+i);
17?????????????userlist.add(user);
18?????????}
19?????????return?userlist;
20?????}
21?}
??1?嚴重:?StandardWrapper.Throwable
??2?Server?Runtime?Error:?javax.xml.ws.WebServiceException
??3?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:269)
??4?????at?com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:87)
??5?????at?com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:59)
??6?????at?javax.xml.ws.Endpoint.publish(Endpoint.java:156)
??7?????at?WebServiceStarter.init(WebServiceStarter.java:21)
??8?????at?javax.servlet.GenericServlet.init(GenericServlet.java:212)
??9?????at?org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
?10?????at?org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
?11?????at?org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4044)
?12?????at?org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
?13?????at?org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
?14?????at?org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
?15?????at?org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
?16?????at?org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
?17?????at?org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
?18?????at?org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
?19?????at?org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
?20?????at?org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
?21?????at?org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
?22?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
?23?????at?org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
?24?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
?25?????at?org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?26?????at?org.apache.catalina.core.StandardService.start(StandardService.java:451)
?27?????at?org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?28?????at?org.apache.catalina.startup.Catalina.start(Catalina.java:552)
?29?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
?30?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?31?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?32?????at?java.lang.reflect.Method.invoke(Method.java:597)
?33?????at?org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
?34?????at?org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
?35?Caused?by:?javax.xml.ws.WebServiceException
?36?????at?com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:201)
?37?????at?com.sun.xml.internal.ws.model.RuntimeModel.postProcess(RuntimeModel.java:79)
?38?????at?com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255)
?39?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.createSEIModel(RuntimeEndpointInfo.java:170)
?40?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.init(RuntimeEndpointInfo.java:317)
?41?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:298)
?42?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:263)
?43?????
?31?more
?44?Caused?by:?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:?1?counts?of?IllegalAnnotationExceptions
?45?java.util.List?is?an?interface,?and?JAXB?can't?handle?interfaces.
?46?????this?problem?is?related?to?the?following?location:
?47?????????at?java.util.List
?48?
?49?????at?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
?50?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:361)
?51?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:217)
?52?????at?com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
?53?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
?54?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?55?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?56?????at?java.lang.reflect.Method.invoke(Method.java:597)
?57?????at?com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:76)
?58?????at?com.sun.xml.internal.ws.model.RuntimeModel$1.run(RuntimeModel.java:196)
?59?????at?java.security.AccessController.doPrivileged(Native?Method)
?60?????at?com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:193)
?61?????
?37?more
?62?2007-1-19?9:53:07?org.apache.catalina.core.StandardContext?loadOnStartup
?63?嚴重:?Servlet?/java6.web.service?threw?load()?exception
?64?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:?1?counts?of?IllegalAnnotationExceptions
?65?java.util.List?is?an?interface,?and?JAXB?can't?handle?interfaces.
?66?????this?problem?is?related?to?the?following?location:
?67?????????at?java.util.List
?68?
?69?????at?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
?70?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:361)
?71?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:217)
?72?????at?com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
?73?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
?74?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?75?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?76?????at?java.lang.reflect.Method.invoke(Method.java:597)
?77?????at?com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:76)
?78?????at?com.sun.xml.internal.ws.model.RuntimeModel$1.run(RuntimeModel.java:196)
?79?????at?java.security.AccessController.doPrivileged(Native?Method)
?80?????at?com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:193)
?81?????at?com.sun.xml.internal.ws.model.RuntimeModel.postProcess(RuntimeModel.java:79)
?82?????at?com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255)
?83?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.createSEIModel(RuntimeEndpointInfo.java:170)
?84?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.init(RuntimeEndpointInfo.java:317)
?85?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:298)
?86?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:263)
?87?????at?com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:87)
?88?????at?com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:59)
?89?????at?javax.xml.ws.Endpoint.publish(Endpoint.java:156)
?90?????at?WebServiceStarter.init(WebServiceStarter.java:21)
?91?????at?javax.servlet.GenericServlet.init(GenericServlet.java:212)
?92?????at?org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
?93?????at?org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
?94?????at?org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4044)
?95?????at?org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
?96?????at?org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
?97?????at?org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
?98?????at?org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
?99?????at?org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
100?????at?org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
101?????at?org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
102?????at?org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
103?????at?org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
104?????at?org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
105?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
106?????at?org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
107?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
108?????at?org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
109?????at?org.apache.catalina.core.StandardService.start(StandardService.java:451)
110?????at?org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
111?????at?org.apache.catalina.startup.Catalina.start(Catalina.java:552)
112?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
113?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
114?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
115?????at?java.lang.reflect.Method.invoke(Method.java:597)
116?????at?org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
117?????at?org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
修改服務端代碼:??2?Server?Runtime?Error:?javax.xml.ws.WebServiceException
??3?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:269)
??4?????at?com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:87)
??5?????at?com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:59)
??6?????at?javax.xml.ws.Endpoint.publish(Endpoint.java:156)
??7?????at?WebServiceStarter.init(WebServiceStarter.java:21)
??8?????at?javax.servlet.GenericServlet.init(GenericServlet.java:212)
??9?????at?org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
?10?????at?org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
?11?????at?org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4044)
?12?????at?org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
?13?????at?org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
?14?????at?org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
?15?????at?org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
?16?????at?org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
?17?????at?org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
?18?????at?org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
?19?????at?org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
?20?????at?org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
?21?????at?org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
?22?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
?23?????at?org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
?24?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
?25?????at?org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?26?????at?org.apache.catalina.core.StandardService.start(StandardService.java:451)
?27?????at?org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?28?????at?org.apache.catalina.startup.Catalina.start(Catalina.java:552)
?29?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
?30?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?31?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?32?????at?java.lang.reflect.Method.invoke(Method.java:597)
?33?????at?org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
?34?????at?org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
?35?Caused?by:?javax.xml.ws.WebServiceException
?36?????at?com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:201)
?37?????at?com.sun.xml.internal.ws.model.RuntimeModel.postProcess(RuntimeModel.java:79)
?38?????at?com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255)
?39?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.createSEIModel(RuntimeEndpointInfo.java:170)
?40?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.init(RuntimeEndpointInfo.java:317)
?41?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:298)
?42?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:263)
?43?????

?44?Caused?by:?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:?1?counts?of?IllegalAnnotationExceptions
?45?java.util.List?is?an?interface,?and?JAXB?can't?handle?interfaces.
?46?????this?problem?is?related?to?the?following?location:
?47?????????at?java.util.List
?48?
?49?????at?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
?50?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:361)
?51?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:217)
?52?????at?com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
?53?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
?54?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?55?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?56?????at?java.lang.reflect.Method.invoke(Method.java:597)
?57?????at?com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:76)
?58?????at?com.sun.xml.internal.ws.model.RuntimeModel$1.run(RuntimeModel.java:196)
?59?????at?java.security.AccessController.doPrivileged(Native?Method)
?60?????at?com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:193)
?61?????

?62?2007-1-19?9:53:07?org.apache.catalina.core.StandardContext?loadOnStartup
?63?嚴重:?Servlet?/java6.web.service?threw?load()?exception
?64?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:?1?counts?of?IllegalAnnotationExceptions
?65?java.util.List?is?an?interface,?and?JAXB?can't?handle?interfaces.
?66?????this?problem?is?related?to?the?following?location:
?67?????????at?java.util.List
?68?
?69?????at?com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
?70?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:361)
?71?????at?com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:217)
?72?????at?com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
?73?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
?74?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?75?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?76?????at?java.lang.reflect.Method.invoke(Method.java:597)
?77?????at?com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:76)
?78?????at?com.sun.xml.internal.ws.model.RuntimeModel$1.run(RuntimeModel.java:196)
?79?????at?java.security.AccessController.doPrivileged(Native?Method)
?80?????at?com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:193)
?81?????at?com.sun.xml.internal.ws.model.RuntimeModel.postProcess(RuntimeModel.java:79)
?82?????at?com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255)
?83?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.createSEIModel(RuntimeEndpointInfo.java:170)
?84?????at?com.sun.xml.internal.ws.server.RuntimeEndpointInfo.init(RuntimeEndpointInfo.java:317)
?85?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:298)
?86?????at?com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:263)
?87?????at?com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:87)
?88?????at?com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:59)
?89?????at?javax.xml.ws.Endpoint.publish(Endpoint.java:156)
?90?????at?WebServiceStarter.init(WebServiceStarter.java:21)
?91?????at?javax.servlet.GenericServlet.init(GenericServlet.java:212)
?92?????at?org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
?93?????at?org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
?94?????at?org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4044)
?95?????at?org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
?96?????at?org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
?97?????at?org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
?98?????at?org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
?99?????at?org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
100?????at?org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
101?????at?org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
102?????at?org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
103?????at?org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
104?????at?org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
105?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
106?????at?org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
107?????at?org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
108?????at?org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
109?????at?org.apache.catalina.core.StandardService.start(StandardService.java:451)
110?????at?org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
111?????at?org.apache.catalina.startup.Catalina.start(Catalina.java:552)
112?????at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
113?????at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
114?????at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
115?????at?java.lang.reflect.Method.invoke(Method.java:597)
116?????at?org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
117?????at?org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
?1?import?java.util.ArrayList;
?2?import?javax.jws.WebMethod;
?3?import?javax.jws.WebService;
?4?import?javax.jws.soap.SOAPBinding;
?5?
?6?@WebService(targetNamespace?=?"http://jdk.study.hermit.org/testlist")
?7?@SOAPBinding(style?=?SOAPBinding.Style.RPC)
?8?public?class?GetList?{
?9?????@WebMethod
10?????public?ArrayList<UserInfo>?getList(int?n)?{
11?????????ArrayList<UserInfo>?userlist?=?new?ArrayList<UserInfo>();
12?????????for?(int?i?=?0;?i?<?n;?i++)?{
13?????????????UserInfo?user?=?new?UserInfo();
14?????????????user.setId(i);
15?????????????user.setName("name"+i);
16?????????????userlist.add(user);
17?????????}
18?????????return?userlist;
19?????}
20?}
啟動OK?2?import?javax.jws.WebMethod;
?3?import?javax.jws.WebService;
?4?import?javax.jws.soap.SOAPBinding;
?5?
?6?@WebService(targetNamespace?=?"http://jdk.study.hermit.org/testlist")
?7?@SOAPBinding(style?=?SOAPBinding.Style.RPC)
?8?public?class?GetList?{
?9?????@WebMethod
10?????public?ArrayList<UserInfo>?getList(int?n)?{
11?????????ArrayList<UserInfo>?userlist?=?new?ArrayList<UserInfo>();
12?????????for?(int?i?=?0;?i?<?n;?i++)?{
13?????????????UserInfo?user?=?new?UserInfo();
14?????????????user.setId(i);
15?????????????user.setName("name"+i);
16?????????????userlist.add(user);
17?????????}
18?????????return?userlist;
19?????}
20?}
但是客戶端
執行wsimport -keep? http://localhost:8080/ListService?wsdl,一共生成了7個文件
AbstractCollection.java
AbstractList.java
ArrayList.java
GetList.java
GetListService.java
ObjectFactory.java
package-info.java
測試代碼
?1?package?test;
?2?
?3?import?static?org.junit.Assert.assertNotNull;
?4?import?org.hermit.study.jdk.testlist.ArrayList;
?5?import?org.hermit.study.jdk.testlist.GetList;
?6?import?org.hermit.study.jdk.testlist.GetListService;
?7?import?org.junit.Test;
?8?
?9?public?class?TestList?{
10?????@Test
11?????public?void?getList()?{
12?????????GetListService?service?=?new?GetListService();
13?????????GetList?obj?=?service.getGetListPort();
14?????????
15?????????ArrayList?userlist?=?obj.getList(5);
16?????????assertNotNull(userlist);
17?????????
18?????}
19?}
可以看到ArrayList?userlist?=?obj.getList(5);中的list是org.hermit.study.jdk.testlist.ArrayList;?2?
?3?import?static?org.junit.Assert.assertNotNull;
?4?import?org.hermit.study.jdk.testlist.ArrayList;
?5?import?org.hermit.study.jdk.testlist.GetList;
?6?import?org.hermit.study.jdk.testlist.GetListService;
?7?import?org.junit.Test;
?8?
?9?public?class?TestList?{
10?????@Test
11?????public?void?getList()?{
12?????????GetListService?service?=?new?GetListService();
13?????????GetList?obj?=?service.getGetListPort();
14?????????
15?????????ArrayList?userlist?=?obj.getList(5);
16?????????assertNotNull(userlist);
17?????????
18?????}
19?}
而非util的list
郁悶,繼續找資料看看怎么傳list吧