package com.soap.server;import java.util.Date;
import javax.xml.bind.annotation.XmlRootElement;@XmlRootElement(name = "Customer")
public class Customer {
private long id;
private String name;
private Date birthday; public long getId() {
return id;
} public void setId(long id) {
this.id = id;
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public Date getBirthday() {
return birthday;
} public void setBirthday(Date birthday) {
this.birthday = birthday;
}
}package com.soap.server;import javax.jws.WebService;@WebService
public interface IHelloService {
Customer selectMaxAgeStudent(Customer c1, Customer c2); Customer selectMaxLongNameStudent(Customer c1, Customer c2);
}
package com.soap.server;public class HelloServiceImpl implements IHelloService {
@Override
public Customer selectMaxAgeStudent(Customer c1, Customer c2) {
if (c1.getBirthday().getTime() > c2.getBirthday().getTime())
return c2;
else
return c1;
} @Override
public Customer selectMaxLongNameStudent(Customer c1, Customer c2) {
if (c1.getName().length() > c2.getName().length())
return c1;
else
return c2;
}
}
package com.soap.server;import javax.xml.ws.Endpoint;public class SoapServer {
public static void main(String[] args) {
Endpoint.publish("http://127.0.0.1:8080/helloService",
new HelloServiceImpl());
}
}上面这段代码有什么问题,为什么我运行main后总是报java.lang.NullPointerException空指针呢?如果不对,请问正确的方法应该怎样写,谢谢!