java soap服务端注册_Java的进程内SOAP服务服务器

小编典典

似乎jdk 6.0已经带有jax-ws实现,并且可以嵌入一个小的服务器。我还没有弄清楚所有的东西,但是这是一个开始:

mkdir -p helloservice/endpoint/

helloservice / endpoint / Hello.java:

package helloservice.endpoint;

import javax.jws.WebService;

@WebService()

public class Hello {

private String message = new String("Hello, ");

public void Hello() {}

public String sayHello(String name) {

return message + name + ".";

}

}

helloservice / endpoint / Server.java:

package helloservice.endpoint;

import javax.xml.ws.Endpoint;

public class Server {

protected Server() throws Exception {

System.out.println("Starting Server");

Object implementor = new Hello();

String address = "http://localhost:9000/SoapContext/SoapPort";

Endpoint.publish(address, implementor);

}

public static void main(String args[]) throws Exception {

new Server();

System.out.println("Server ready...");

Thread.sleep(5 * 60 * 1000);

System.out.println("Server exiting");

System.exit(0);

}

}

建立东西:

mkdir build

javac -d build helloservice/endpoint/*java

$JAVA_HOME/wsgen -d build -s build -classpath . helloservice.endpoint.Hello

运行东西:

java -cp build helloservice.endpoint.Server

还没有找到客户的机会。

2020-10-07

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值