Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java service.getPort thowing NullPointerException JAX-WS_Java_Web Services_Soap_Jax Ws - Fatal编程技术网

Java service.getPort thowing NullPointerException JAX-WS

Java service.getPort thowing NullPointerException JAX-WS,java,web-services,soap,jax-ws,Java,Web Services,Soap,Jax Ws,调用service.getPort(HelloInterface.class)时,我得到了一个NullPointerException 网络服务: @WebService(endpointInterface="com.endpoints.HelloInterface") public class HelloImpl implements HelloInterface{ public void sayHello(){ System.out.println("Hello W

调用service.getPort(HelloInterface.class)时,我得到了一个NullPointerException

网络服务:

@WebService(endpointInterface="com.endpoints.HelloInterface")
public class HelloImpl implements HelloInterface{

    public void sayHello(){
        System.out.println("Hello World!!");
    }
}


@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface HelloInterface {

    @WebMethod
    public void sayHello();

}
客户:

public class Launcher {

    public static void main(String[] args) {
        try {
            URL url = new URL("http://localhost:8881/ws/service1?wsdl");
            QName qname = new QName("http://endpoints.com/", "HelloImplService");
            Service service = Service.create(url, qname);
            HelloInterface helloInterface = service
                    .getPort(HelloInterface.class);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
堆栈跟踪:

java.lang.NullPointerException
    at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
    at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at javax.xml.ws.Service.getPort(Unknown Source)
    at Launcher.main(Launcher.java:14)
在命令提示符下使用wsgen时,我在命令提示符下没有收到任何类型的输出

非常感谢您的帮助