I novice in jax-ws
I have following interface
@WebService(name = "HelloWorld", targetNamespace = "http://pack/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface HelloWorld {
/**
*
* @param arg0
* @return
* returns java.lang.String
*/
@WebMethod
@WebResult(partName = "return")
public String getHelloWorldAsString(
@WebParam(name = "arg0", partName = "arg0")
String arg0);
}
following implementation
@WebService(endpointInterface = "pack.HelloWorld")
public class HelloWorldImpl implements HelloWorld{
@Override
public String getHelloWorldAsString(String name) {
return "Hello World JAX-WS " + name;
}
}
following client code:
public class HelloWorldClient{
public static void main(String[] args) throws Exception {
URL url = new URL("http://localhost:9999/ws/hello?wsdl");
//1st argument service URI, refer to wsdl document above
//2nd argument is service name, refer to wsdl document above
QName qname = new QName("http://pack/", "HelloWorldImplService");
Service service = Service.create(url, qname);
HelloWorld hello = service.getPort(HelloWorld.class);
System.out.println(hello.getHelloWorldAsString("mkyong"));
}
}
In console I see
Hello World JAX-WS mkyong
TCP/IP monitor:
I configure it so:
Why I don't see messages at TCP/IP monitor?
UPDATE Pignic
if I type same local monitoring port and port(ok button disabled) I see next:
UPDATE 2
after that
I see old behaviour
PUBLISHER
I forget add code for publisher:
public class HelloWorldPublisher{
public static void main(String[] args) {
Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());
}
我认为在“主机名”中应该放置“ localhost”,在“ LocalPort”中应该放置“ 9999”。
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.