私はjax-wsの初心者です
私は次のインターフェースを持っています
@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);
}
次の実装
@WebService(endpointInterface = "pack.HelloWorld")
public class HelloWorldImpl implements HelloWorld{
@Override
public String getHelloWorldAsString(String name) {
return "Hello World JAX-WS " + name;
}
}
次のクライアント コード:
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"));
}
}
コンソールで私は見る
Hello World JAX-WS mkyong
TCP/IP モニター:
私はそれを次のように構成します:
TCP/IP モニターでメッセージが表示されないのはなぜですか?
更新ピグニック
同じローカル モニタリング ポートとポートを入力すると ([OK] ボタンが無効)、次のように表示されます。
更新 2
その後
古い動作が見られる
パブリッシャー
パブリッシャーのコードを追加するのを忘れました:
public class HelloWorldPublisher{
public static void main(String[] args) {
Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());
}