zoukankan      html  css  js  c++  java
  • webService客户端service方式搭建(四)

    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方式相同。

  • 相关阅读:
    such用法
    divorce用法
    towel用法
    go for用法
    catch on用法
    incredibly用法
    mess用法
    dentist用法
    steer clear of用法
    incredible
  • 原文地址:https://www.cnblogs.com/duyunchao-2261/p/7448235.html
Copyright © 2011-2022 走看看