JAX-WS:class 未找到
JAX-WS : class not found
我不太熟悉Java。这是我正在尝试实现的网络服务 - 一个基本示例,我面临编译错误。
我不确定我在这里错过了什么。
这是代码。
package com.joshis1.jaxws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style = Style.DOCUMENT)
public interface IwebServiceInterface {
@WebMethod String sayHello(String name);
}
接下来,实现接口
package com.joshis1.jaxws;
import javax.jws.WebService;
@WebService(endpointInterface = "com.joshis1.jaxws")
public class webServiceImpl implements IwebServiceInterface {
@Override
public String sayHello(String name)
{
return "Hello Shreyas " + name;
}
}
接下来主要class发布端点
package com.joshis1.publisher;
import javax.xml.ws.Endpoint;
import com.joshis1.jaxws.*;
public class WebServicePublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8888/webservice/helloworld", new webServiceImpl());
}
}
接下来,非常基本的问题 - 我需要在这里安装网络服务器吗?
您正将 endpointInterface
指向您的包裹:
@WebService(endpointInterface = "com.joshis1.jaxws")
需要引用你的接口:
@WebService(endpointInterface = "com.joshis1.jaxws.IwebServiceInterface")
查看错误信息非常重要
class:com.joshis1.jaxws could not be found
我不太熟悉Java。这是我正在尝试实现的网络服务 - 一个基本示例,我面临编译错误。 我不确定我在这里错过了什么。
这是代码。
package com.joshis1.jaxws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style = Style.DOCUMENT)
public interface IwebServiceInterface {
@WebMethod String sayHello(String name);
}
接下来,实现接口
package com.joshis1.jaxws;
import javax.jws.WebService;
@WebService(endpointInterface = "com.joshis1.jaxws")
public class webServiceImpl implements IwebServiceInterface {
@Override
public String sayHello(String name)
{
return "Hello Shreyas " + name;
}
}
接下来主要class发布端点
package com.joshis1.publisher;
import javax.xml.ws.Endpoint;
import com.joshis1.jaxws.*;
public class WebServicePublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8888/webservice/helloworld", new webServiceImpl());
}
}
接下来,非常基本的问题 - 我需要在这里安装网络服务器吗?
您正将 endpointInterface
指向您的包裹:
@WebService(endpointInterface = "com.joshis1.jaxws")
需要引用你的接口:
@WebService(endpointInterface = "com.joshis1.jaxws.IwebServiceInterface")
查看错误信息非常重要
class:com.joshis1.jaxws could not be found