Java web service not giving error message

此生再无相见时 提交于 2019-12-25 05:12:49

问题


I am doing a simple Hello World example of java webservices, which is of document style from this link, he told that at step Number 3 , we will get an error message "Wrapper class com.mkyong.ws.jaxws.GetHelloWorldAsString is not found. Have you run APT to generate them?". But with out using wsgen, I am able to run my application with out any exception and able to see the output at client end. I am unable to find the reason , why didn't I get the error message? Here is my code: HelloWorld.java :

   package com.XXX.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style = Style.DOCUMENT,use=Use.LITERAL)
public interface HelloWorld {

    @WebMethod String getHelloWorldAsString(String name);
}

HelloWorldImpl.java:

package com.XXX.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(endpointInterface = "com.XXX.ws.HelloWorld")
public class HelloWorldImpl implements HelloWorld {

    @Override
    public String getHelloWorldAsString(String name) {
        // TODO Auto-generated method stub
        return "Hello"+name;
    }

}

Publisher.java

package com.XXX.endOP;

import javax.xml.ws.Endpoint;

import com.XXX.ws.HelloWorldImpl;

public class EndPublisher {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());
        System.out.println("Started");
    }

}

回答1:


After so much search found the following line

Using javac with JAX-WS annotation processor will generates the portable artifacts used in JAX-WS services. from this link https://jax-ws.java.net/nonav/2.2.6/docs/ch04.html



来源:https://stackoverflow.com/questions/35985092/java-web-service-not-giving-error-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!