简体   繁体   中英

JAX-WS : class not found

I am not well versed with Java. Here is the webservice, I am trying to implement - a basic example and I am facing compilation error. I am not sure what am I missing here.

在此处输入图片说明

Here is the code.

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);
}

Next, implementing the interface

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;
     }
}

Next, the main class to publish the endpoint

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());

    }

}

Next, very basic question - Do I need to install a web server here?

You are pointing your endpointInterface to your package:

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

It needs to reference your interface:

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

It is very important to look on what the error is saying

class:com.joshis1.jaxws could not be found

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM