日期:2014-05-20 浏览次数:20712 次
@WebService public interface IHelloService { Customer selectMaxAgeStudent(Customer c1, Customer c2); Customer selectMaxLongNameStudent(Customer c1, Customer c2); }
public class HelloServiceImpl implements IHelloService { @Override public Customer selectMaxAgeStudent(Customer c1, Customer c2) { if (c1.getBirthday().getTime() > c2.getBirthday().getTime()) { return c1; } else { return c2; } } @Override public Customer selectMaxLongNameStudent(Customer c1, Customer c2) { if (c1.getName().length() > c2.getName().length()) { return c1; } else { return c2; } } }
@XmlRootElement(name = "customer") public class Customer { private long id; private String name; private Date birthday; 。。。。。。get set。。。
public class SoapServer { public static void main(String[] args) { Endpoint.publish("http://127.0.0.1:8080/helloService", new HelloServiceImpl()); }
Exception in thread "main" java.lang.NullPointerException at com.sun.xml.internal.ws.server.EndpointFactory.getWsdlLocation(EndpointFactory.java:385) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.getPrimaryWsdl(EndpointImpl.java:265) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:208) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:138) at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:92) at javax.xml.ws.Endpoint.publish(Endpoint.java:170) at com.gsoft.server.util.SoapServer.main(SoapServer.java:26)