67,513
社区成员
发帖
与我相关
我的任务
分享
package com.erdb.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService
public class ServiceHello {
/**
* 生成客户端:
* wsimport -s E:\\GDHT_SOFTWARE\\中核设备可靠性数据库\\田湾项目\\SAP接口研发\\project\\TheClient\\src -p com.erdb.client -keep http://localhost:9001/Service/ServiceHello?wsdl
* 供客户端调用的方法
* @param name 传入参数
* @return List 返回结果
*/
public List<Student> getValue(String name){
// System.out.println(name);
// List<String> arrayString = new ArrayList<String>();
// arrayString.add("姓名:" + name);
// arrayString.add("性别:男");
// arrayString.add("年龄:25");
List<Student> arrayString = new ArrayList<Student>();
return arrayString;
}
// /***
// * @param mapName
// * @param mapObject
// * @return
// */
// public Map<String, Object> getMap(String mapName, String mapObject) {
// Map<String, Object> map = new HashMap<String, Object>();
// map.put(mapName, mapObject);
// return map;
// }
/**
* @param args
*/
public static void main(String[] args) {
Endpoint.publish("http://127.0.0.1:9001/Service/ServiceHello", new ServiceHello());
System.out.println("service success!");
}
}
package com.erdb.service;
public class Student {
public String name;
public String sex;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
}
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:156)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:84)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:235)
at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:328)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:190)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:498)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:246)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:170)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:113)
at javax.xml.ws.Endpoint.publish(Endpoint.java:220)
at com.erdb.service.ServiceHello.main(ServiceHello.java:45)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Class has two properties of the same name "name"
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.getName()
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.name
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
Class has two properties of the same name "sex"
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.getSex()
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.sex
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:143)
... 10 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Class has two properties of the same name "name"
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.getName()
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.name
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
Class has two properties of the same name "sex"
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.getSex()
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
this problem is related to the following location:
at public java.lang.String com.erdb.service.Student.sex
at com.erdb.service.Student
at public java.util.List com.erdb.service.jaxws.GetValueResponse._return
at com.erdb.service.jaxws.GetValueResponse
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:283)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:126)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:173)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:96)
at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:98)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:151)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:143)
... 12 more