java - JAX-WS:找不到类
问题描述
我不精通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;
}
}
接下来,发布端点的主类
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")
查看错误在说什么非常重要
类:com.joshis1.jaxws找不到
推荐阅读
- ubuntu - Apache 的 Ubuntu 文件权限问题
- can-bus - J1939 - 我应该使用什么 PGN 号码来请求删除 NAME?
- angular - mat-error 不显示它是错误消息?
- c++ - C ++ 23中default_constructible范围适配器的含义是什么?
- kubernetes - 如何将流量重定向到 403 错误而不是 kubernetes 集群上的广泛列出的流量
- css - 背景图像被导航栏覆盖
- c++ - 检查元组中的项目是否包含特定方法
- scala - 为什么 Flink 在独立集群中运行比在 IDE 中运行慢?
- java - 在多线程中更新实体
- java - 将元素从一个数组复制到另一个数组