首页 > Web开发 > 详细

webService客户端service方式搭建(四)

时间:2017-08-29 15:00:18      阅读:274      评论:0      收藏:0      [点我收藏+]
package me.gacl.ws.client;

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;

import me.gacl.phonenum.MobileCodeWSSoap;



public class weatherService_Service {
	public static void main(String[] args) throws Exception {
		URL url = new URL("http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl");
//		namespaceURI -- 命名空间地址
//		localPart	-- 服务视图名
		
		QName qname = new QName("http://WebXml.com.cn/", "MobileCodeWS");
//		serviceName	--服务名称
//		wsdlDocumentLocation -- wsdl地址
		Service service = Service.create(url,qname);

//		获取service实现类
		MobileCodeWSSoap mobileCodeWSSoap = service.getPort(MobileCodeWSSoap.class);
		String mobileCodeInfo = mobileCodeWSSoap.getMobileCodeInfo("1861234","");
		System.out.println(mobileCodeInfo);
	}
}

  代码如上,获取wsdl方式相同。

webService客户端service方式搭建(四)

原文:http://www.cnblogs.com/duyunchao-2261/p/7448235.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!