【问题标题】:JAX-WS : class not foundJAX-WS:找不到类
【发布时间】:2018-12-19 23:05:19
【问题描述】:

我并不精通 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());

    }

}

接下来,非常基本的问题 - 我需要在这里安装网络服务器吗?

【问题讨论】:

  • 你确实需要在你的类路径中有一些 JAX-WS 实现。
  • 实际上他将他的端点接口指向一个包'com.joshis1.jaxws'而不是指向接口
  • @Prawn Hongs,这里有一个链接给你看看:tomee.apache.org/examples-trunk/simple-webservice

标签: java jax-ws


【解决方案1】:

您将endpointInterface 指向您的包裹:

@WebService(endpointInterface = "com.joshis1.jaxws")

它需要引用你的接口:

@WebService(endpointInterface = "com.joshis1.jaxws.IwebServiceInterface")

查看错误的含义非常重要

class:com.joshis1.jaxws找不到

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2012-01-11
    • 2012-03-08
    • 2011-10-20
    • 2011-03-19
    • 1970-01-01
    • 2011-03-06
    相关资源
    最近更新 更多