亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 10.txt

?? 《JAVA WEB服務應用開發詳解》代碼
?? TXT
?? 第 1 頁 / 共 5 頁
字號:
例程10-1
// org.apache.soap.server.ServiceManagerClient.Java
package org.apache.soap.server;
import Java.net.URL;
import Java.io.*;
import Java.util.*;
import Javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.transport.http.SOAPHTTPConnection;
import org.apache.soap.rpc.*;
/**
 * This is a client to talk to an Apache SOAP ServiceManager to manage services
 * deployed on the server.
 *
 * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
 */
public class ServiceManagerClient {
  URL routerURL;
  Vector params = new Vector ();
  Call call = new Call ();
  String userName;
  String password;
  public ServiceManagerClient (URL routerURL) {
    Serializer bs = new org.apache.soap.encoding.soapenc.BeanSerializer ();
    this.routerURL = routerURL;
    SOAPMappingRegistry smr = call.getSOAPMappingRegistry ();
    // register serializer/deserializer for DeploymentDescriptor.class
    // and TypeMapping.class
    smr.mapTypes (Constants.NS_URI_SOAP_ENC,
                  new QName (Constants.NS_URI_XML_SOAP,
                             "DeploymentDescriptor"),
                  DeploymentDescriptor.class, bs, (Deserializer) bs);
    bs = new TypeMappingSerializer ();
    smr.mapTypes (Constants.NS_URI_SOAP_ENC,
                  new QName (Constants.NS_URI_XML_SOAP, "TypeMapping"),
                  TypeMapping.class, bs, (Deserializer) bs);
  }
  public void setUserName (String userName) {
    this.userName = userName;
  }
  public void setPassword (String password) {
    this.password = password;
  }
//invoke the remote rpc method
  private Response invokeMethod (String methodName, Parameter param) 
       throws SOAPException {
    call.setTargetObjectURI (ServerConstants.SERVICE_MANAGER_SERVICE_NAME);
    call.setMethodName (methodName);
    call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);
    if (userName != null) {
      SOAPHTTPConnection hc = new SOAPHTTPConnection ();
      hc.setUserName (userName);
      hc.setPassword (password);
      call.setSOAPTransport (hc);
    }
    if (param != null) {
      params.removeAllElements ();
      params.addElement (param);
      call.setParams (params);
    } else {
      call.setParams (null);
    }
    Response resp = call.invoke (routerURL, "");
    if (resp.generatedFault ()) {
      Fault fault = resp.getFault ();
      System.out.println ("Ouch, the call failed: ");
      System.out.println ("  Fault Code   = " + fault.getFaultCode ());  
      System.out.println ("  Fault String = " + fault.getFaultString ());
    }  
    return resp;
  }
//deploy a new service descripted by the specified DD
  public void deploy (DeploymentDescriptor dd) throws SOAPException {
    Parameter p1 = new Parameter ("descriptor", DeploymentDescriptor.class,
                                  dd, null);
    invokeMethod ("deploy", p1);
  }
//undeploy specified service
  public void undeploy (String serviceName) throws SOAPException {
    Parameter p1 = new Parameter ("name", String.class, serviceName, null);
    invokeMethod ("undeploy", p1);
  }
  
//list the deployed services
  public String[] list () throws SOAPException {
    Response resp = invokeMethod ("list", null);
    if (!resp.generatedFault ()) {
      Parameter result = resp.getReturnValue ();
      return (String[]) result.getValue ();
    } else {
      return null;
    }
  }
//query specified service 
  public DeploymentDescriptor query (String serviceName) throws SOAPException {
    Parameter p1 = new Parameter ("name", String.class, serviceName, null);
    Response resp = invokeMethod ("query", p1);
    if (!resp.generatedFault ()) {
      Parameter result = resp.getReturnValue ();
      return (DeploymentDescriptor) result.getValue ();
    } else {

Exception {
12    
13    	Call call = new Call ();
14    
15            // Service uses standard SOAP encoding
16    	String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
17    	call.setEncodingStyleURI(encodingStyleURI);
18    
19            // Set service locator parameters
20    	call.setTargetObjectURI ("urn:xmethods-Temperature");
21    	call.setMethodName ("getTemp");
22    
23            // Create input parameter vector
24    	Vector params = new Vector ();
25    	params.addElement (new Parameter("zipcode", String.class, zipcode, null));
26    	call.setParams (params);
27    
28            // Invoke the service ....
29            Response resp = call.invoke (url,"");
30    
31           // ... and evaluate the response
32    	if (resp.generatedFault ()) {
33    	    throw new Exception();
34    	} else {
35              // Call was successful. Extract response parameter and return result
36    	    Parameter result = resp.getReturnValue ();
37    	    Float rate=(Float) result.getValue();
38    	    return rate.floatValue();
39    	}
40        }
41    
42    // Driver to illustrate service invocation
43        public static void main(String[] args)
44        {
45        try
46    	{
47    	    URL url=new URL("http://services.xmethods.com:80/soap/servlet/rpcrouter");
48    	    String zipcode= "94041";
49    	    float temp = getTemp(url,zipcode);
50    	    System.out.println(temp);
51    	}
52        catch (Exception e) {e.printStackTrace();}
53        }
54    }
例程10-4
001     /** 
002      * SOAPClient4XG. Read the SOAP envelope file passed as the second
003      * parameter, pass it to the SOAP endpoint passed as the first parameter, and
004      * print out the SOAP envelope passed as a response.  with help from Michael
005      * Brennan 03/09/01
006      * 
007      *
008      * @author  Bob DuCharme
009      * @version 1.1
010      * @param   SOAPUrl      URL of SOAP Endpoint to send request.
011      * @param   xmlFile2Send A file with an XML document of the request.  
012      *
013      * 5/23/01 revision: SOAPAction added
014     */
015     
016     import Java.io.*;
017     import Java.net.*;
018     
019     public class SOAPClient4XG {
020         public static void main(String[] args) throws Exception {
021     
022             if (args.length  < 2) {
023                 System.err.println("Usage:  Java SOAPClient4XG " +
024                                    "http://soapURL soapEnvelopefile.xml" +
025                                    " [SOAPAction]");
026     				System.err.println("SOAPAction is optional.");
027                 System.exit(1);
028             }
029     
030             String SOAPUrl      = args[0];
031             String xmlFile2Send = args[1];
032     
033     		  String SOAPAction = "";
034             if (args.length  > 2) 
035     				SOAPAction = args[2];
036     		  
037             // Create the connection where we're going to send the file.
038             URL url = new URL(SOAPUrl);
039             URLConnection connection = url.openConnection();
040             HttpURLConnection httpConn = (HttpURLConnection) connection;
041     
042             // Open the input file. After we copy it to a byte array, we can see
043             // how big it is so that we can set the HTTP Cotent-Length
044             // property. (See complete e-mail below for more on this.)
045     
046             FileInputStream fin = new FileInputStream(xmlFile2Send);
047     
048             ByteArrayOutputStream bout = new ByteArrayOutputStream();    
049     
050             // Copy the SOAP file to the open connection.
051             copy(fin,bout);
052             fin.close();
053           
054             byte[] b = bout.toByteArray();
055     
056             // Set the appropriate HTTP parameters.
057             httpConn.setRequestProperty( "Content-Length",
058                                          String.valueOf( b.length ) );
059             httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
060     		  httpConn.setRequestProperty("SOAPAction",SOAPAction);
061             httpConn.setRequestMethod( "POST" );
062             httpConn.setDoOutput(true);
063             httpConn.setDoInput(true);
064        
065             // Everything's set up; send the XML that was read in to b.
066             OutputStream out = httpConn.getOutputStream();
067             out.write( b );    
068             out.close();
069     
070             // Read the response and write it to standard out.
071     
072             InputStreamReader isr =
073                 new InputStreamReader(httpConn.getInputStream());
074             BufferedReader in = new BufferedReader(isr);
075     
076             String inputLine;
077     
078             while ((inputLine = in.readLine()) != null)
079                 System.out.println(inputLine);
080     
081             in.close();
082         }
083     
084     
085       // copy method from From E.R. Harold's book "Java I/O"
086       public static void copy(InputStream in, OutputStream out) 
087        throws IOException {
088     
089         // do not allow other threads to read from the
090         // input or write to the output while copying is
091         // taking place
092         
093         synchronized (in) {
094           synchronized (out) {
095     
096             byte[] buffer = new byte[256];
097             while (true) {
098               int bytesRead = in.read(buffer);
099               if (bytesRead == -1) break;
100               out.write(buffer, 0, bytesRead);
101             }
102           }
103         }
104       }
例程10-5
01   //samples.stockquote.StockQuoteService.Java
02   package samples.stockquote;
03   
04   import Java.net.URL;
05   import Java.io.*;
06   import org.w3c.dom.*;
07   import org.xml.sax.*;
08   import Javax.xml.parsers.*;
09   import org.apache.soap.util.xml.*;
10   
11   /**
12    * See \samples\stockquote\readme for info.
13    *
14    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
15    */
16   public class StockQuoteService {
17     DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
18   
19     public float getQuote (String symbol) throws Exception {
20       // get a real (delayed by 20min) stockquote from 
21       // http://www.xmltoday.com/examples/stockquote/. The IP addr 
22       // below came from the host that the above form posts to ..
23       URL url = new URL 
         ("http://www.xmltoday.com/examples/stockquote/getxmlquote.vep?s="+symbol);
24       InputStream is = url.openStream ();
25       Document d = xdb.parse(is);
26       Element e = d.getDocumentElement ();
27       NodeList nl = e.getElementsByTagName ("price");
28       e = (Element) nl.item (0);
29       String quoteStr = e.getAttribute ("value");
30       try {
31         return Float.valueOf (quoteStr).floatValue ();
32       } catch (NumberFormatException e1) {
33         // mebbe its an int?
34         try {
35   	return Integer.valueOf (quoteStr).intValue () * 1.0F;
36         } catch (NumberFormatException e2) {
37   	return -1.0F;
38         }
39       }
40     }
41   }
例程10-6
01    // samples.stockquote.GetQuote.Java
02    package samples.stockquote;
03    
04    import Java.io.*;
05    import Java.net.*;
06    import Java.util.*;
07    import org.apache.soap.*;
08    import org.apache.soap.rpc.*;
09    
10    /**
11     * See README for info.
12     *
13     * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
14     */
15    public class GetQuote {
16      public static void main (String[] args) throws Exception {
17        if (args.length != 2
18            && (args.length != 3 || !args[0].startsWith ("-"))) {
19          System.err.println ("Usage: Java " + GetQuote.class.getName () +
20                              " [-encodingStyleURI] SOAP-router-URL symbol");
21          System.exit (1);
22        }
23    
24        // Process the arguments.
25        int offset = 3 - args.length;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美国欧美日韩国产在线播放| 亚洲日本成人在线观看| 91国产免费看| 色综合色狠狠综合色| 成人午夜免费电影| 国产成人av电影| 成人听书哪个软件好| 成人免费视频一区| www.日本不卡| 色婷婷亚洲一区二区三区| 色综合久久久久综合99| 色婷婷激情综合| 欧美色成人综合| 日韩三级高清在线| 欧美成人一区二区三区在线观看| 精品成人私密视频| 精品国产乱码久久久久久图片 | 欧美一区午夜视频在线观看 | 日韩成人免费看| 免费一级欧美片在线观看| 麻豆精品国产传媒mv男同| 久久国产剧场电影| www.色精品| 国产午夜亚洲精品理论片色戒| 精品久久久久一区| 国产精品久久毛片| 亚洲黄色录像片| 麻豆91在线看| 成人av免费在线观看| 欧美网站大全在线观看| 日韩视频不卡中文| 日韩理论片一区二区| 视频一区二区三区在线| 国产成人在线色| 欧美性猛片xxxx免费看久爱| 日韩精品一区在线观看| 综合在线观看色| 日韩成人精品视频| 91视频在线看| 精品免费视频.| 亚洲曰韩产成在线| 国产精品996| 欧美日韩一区二区在线视频| 国产情人综合久久777777| 午夜影院久久久| 不卡av在线网| 精品国产免费久久| 亚洲aaa精品| 色诱视频网站一区| 久久久久久久久岛国免费| 亚洲国产精品人人做人人爽| 粉嫩在线一区二区三区视频| 日韩欧美一二三| 亚洲bdsm女犯bdsm网站| 91麻豆视频网站| 久久久欧美精品sm网站| 首页欧美精品中文字幕| 99久久精品国产导航| 久久久久97国产精华液好用吗| 午夜精品久久一牛影视| 在线亚洲一区二区| 国产精品婷婷午夜在线观看| 久久国产精品99久久久久久老狼| 在线观看av一区二区| 最新久久zyz资源站| 风间由美一区二区av101 | 不卡视频免费播放| 26uuu亚洲综合色欧美| 久久97超碰色| xf在线a精品一区二区视频网站| 午夜国产不卡在线观看视频| 欧美日韩视频在线一区二区| 亚洲一二三四在线| 91国偷自产一区二区开放时间 | 日本电影欧美片| 亚洲美腿欧美偷拍| 色域天天综合网| 一区二区国产视频| 欧美婷婷六月丁香综合色| 一区二区三区精品| 欧洲精品一区二区三区在线观看| 一区二区三区高清不卡| 欧洲色大大久久| 婷婷综合久久一区二区三区| 宅男噜噜噜66一区二区66| 日韩中文字幕区一区有砖一区| 这里只有精品视频在线观看| 蜜乳av一区二区| 国产女人18毛片水真多成人如厕| k8久久久一区二区三区| 亚洲三级小视频| 欧美亚一区二区| 日本不卡视频在线| 精品福利一区二区三区免费视频| 国产一区二区在线观看视频| 国产精品欧美精品| 91成人免费电影| 蜜臀av在线播放一区二区三区 | 不卡欧美aaaaa| 亚洲激情自拍视频| 日韩一区二区三区在线视频| 国产精品18久久久久久久久| 中文字幕视频一区| 69av一区二区三区| 国产精品一线二线三线| 亚洲欧洲另类国产综合| 欧美色倩网站大全免费| 国产原创一区二区三区| 亚洲人亚洲人成电影网站色| 欧美精品tushy高清| 韩国三级中文字幕hd久久精品| 欧美高清在线视频| 欧美日本一区二区三区| 国产精品一区二区久久精品爱涩| 亚洲视频狠狠干| 日韩久久精品一区| 在线视频你懂得一区| 国产高清无密码一区二区三区| 一区二区视频在线看| 精品av久久707| 在线视频欧美区| 成人激情视频网站| 毛片基地黄久久久久久天堂| 亚洲精品高清视频在线观看| 久久噜噜亚洲综合| 91精品国产乱码| 色婷婷国产精品| 国产大陆a不卡| 蜜桃久久久久久久| 亚洲一区影音先锋| 亚洲视频香蕉人妖| 国产无人区一区二区三区| 欧美精品视频www在线观看 | 在线观看国产精品网站| 国产91精品久久久久久久网曝门 | 国产欧美在线观看一区| 欧美一区日本一区韩国一区| 99久久婷婷国产综合精品| 国产夫妻精品视频| 精品影视av免费| 日本三级韩国三级欧美三级| 亚洲综合色成人| 亚洲免费av高清| 亚洲婷婷综合久久一本伊一区| 国产亚洲欧美中文| 国产亚洲一区字幕| 国产日韩欧美麻豆| 国产欧美日韩在线视频| 久久先锋资源网| 久久综合久久综合久久综合| 欧美大片顶级少妇| 精品国产电影一区二区| 26uuuu精品一区二区| 久久美女艺术照精彩视频福利播放| 日韩一区二区三区三四区视频在线观看| 欧美日韩国产首页| 欧美一区二区三区视频免费播放 | eeuss鲁片一区二区三区 | 色婷婷av一区二区三区软件| 91丝袜美腿高跟国产极品老师 | 精品少妇一区二区三区视频免付费| 欧美日韩精品欧美日韩精品一综合| 在线欧美日韩精品| 制服丝袜一区二区三区| 337p亚洲精品色噜噜噜| 欧美成人福利视频| www久久久久| 亚洲国产精品成人综合| 国产精品久久久久久户外露出| 亚洲色图丝袜美腿| 日韩黄色免费电影| 国内精品自线一区二区三区视频| 国产成人8x视频一区二区| eeuss鲁片一区二区三区 | 精品久久99ma| 久久精品日产第一区二区三区高清版| 国产欧美一区二区精品忘忧草 | 欧美一区二区播放| 久久久精品蜜桃| 一区二区三区四区视频精品免费 | 天天亚洲美女在线视频| 激情综合五月天| 9l国产精品久久久久麻豆| 在线观看日韩av先锋影音电影院| 欧美一级日韩不卡播放免费| 久久久99精品久久| 一区二区在线观看不卡| 精品一二线国产| 91麻豆蜜桃一区二区三区| 欧美美女一区二区三区| 国产性色一区二区| 亚洲国产人成综合网站| 国产精品77777| 欧美高清视频在线高清观看mv色露露十八| 精品久久一二三区| 伊人色综合久久天天人手人婷| 精品系列免费在线观看| 一本大道av伊人久久综合| 久久久久久**毛片大全| 视频一区视频二区中文|