一个简单的webService程序

package webservice;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService
public class TestWebservice {
	
	
	public String getValue(String name){
		return "my name is :"+name;
	}
	
	public static void main(String[] args) {
		Endpoint.publish("http://localhost:9001/test/TestWebservice", new TestWebservice());
		System.out.println("webservice success!");
	}
}


直接把代码copy到myeclipse运行就可以了,启动后,在浏览器访问:

http://localhost:9001/test/TestWebservice?wsdl

效果如下
<definitions targetNamespace="http://webservice/" name="TestWebserviceService"><types><xsd:schema>
<xsd:import namespace="http://webservice/" schemaLocation="http://localhost:9001/test/TestWebservice?xsd=1"/>
</xsd:schema></types><message name="getValue"><part name="parameters" element="tns:getValue"/></message>
<message name="getValueResponse"><part name="parameters" element="tns:getValueResponse"/></message>
<portType name="TestWebservice"><operation name="getValue"><input message="tns:getValue"/><output message="tns:getValueResponse"/>
</operation></portType><binding name="TestWebservicePortBinding" type="tns:TestWebservice">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getValue"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/>
</output></operation></binding><service name="TestWebserviceService"><port name="TestWebservicePort" binding="tns:TestWebservicePortBinding">
<soap:address location="http://localhost:9001/test/TestWebservice"/></port></service></definitions>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值