亚洲欧美第一页_禁久久精品乱码_粉嫩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小视频免费观看| 久久99精品国产麻豆婷婷| 樱桃国产成人精品视频| 国产视频一区二区在线| 欧美色电影在线| 国产精品18久久久久| 亚洲国产精品久久久男人的天堂 | 久久不见久久见中文字幕免费| 国产精品免费久久久久| 久久亚洲春色中文字幕久久久| 欧美亚洲日本一区| 91蜜桃免费观看视频| 极品少妇xxxx精品少妇| 亚洲成人av一区二区三区| 亚洲欧洲一区二区在线播放| 日韩欧美高清在线| 欧美日本在线播放| 欧美视频精品在线观看| 99vv1com这只有精品| 国产精品一区二区在线观看网站| 日韩综合小视频| 亚洲日本在线看| 亚洲国产精品ⅴa在线观看| 久久夜色精品国产欧美乱极品| 欧美精品在线一区二区| 欧美视频你懂的| 欧美色老头old∨ideo| 欧美综合天天夜夜久久| 91激情五月电影| 日本高清不卡在线观看| 99久久久国产精品免费蜜臀| www.日韩av| 96av麻豆蜜桃一区二区| 成人午夜精品在线| 成人教育av在线| 成人午夜视频在线| 成人av在线网站| 成人动漫在线一区| 精品久久人人做人人爽| 91麻豆精品国产| 欧美一区二区福利在线| 日韩欧美一区在线观看| 精品国产伦理网| 久久色视频免费观看| 久久九九全国免费| 国产精品少妇自拍| 亚洲免费三区一区二区| 一区二区三区四区乱视频| 亚洲在线成人精品| 日韩主播视频在线| 美日韩黄色大片| 久久成人免费电影| 国产一区二区剧情av在线| 成人免费视频视频| 色8久久精品久久久久久蜜| 欧美日韩精品欧美日韩精品 | 国产乱国产乱300精品| 国产成人午夜精品影院观看视频 | 在线一区二区三区四区五区| 欧美精品v国产精品v日韩精品| 欧美日韩国产在线观看| 日韩欧美在线网站| 国产精品毛片a∨一区二区三区| 亚洲免费观看高清完整版在线观看 | 国产一区二区看久久| 99久久精品免费看国产| 欧美日韩一二区| 欧美大片日本大片免费观看| 国产精品美女一区二区三区| 亚洲午夜精品在线| 国内精品久久久久影院薰衣草| 成人h版在线观看| 欧美日韩在线播放三区| 久久亚洲二区三区| 亚洲男女毛片无遮挡| 蜜桃传媒麻豆第一区在线观看| 国产酒店精品激情| 欧美性极品少妇| 精品国产成人在线影院| 亚洲欧美激情小说另类| 久久99精品国产.久久久久| 日韩一级黄色大片| 国产精品成人免费精品自在线观看| 亚洲线精品一区二区三区八戒| 狠狠色丁香婷婷综合| 欧美性猛交xxxx黑人交| 国产偷国产偷精品高清尤物| 亚洲一区二区三区四区在线免费观看| 极品美女销魂一区二区三区免费| 一本一本大道香蕉久在线精品 | 亚洲精品在线观| 又紧又大又爽精品一区二区| 九九精品一区二区| 欧美四级电影在线观看| 国产精品欧美一区二区三区| 日韩成人免费看| 色综合久久天天| 国产亚洲短视频| 日韩1区2区日韩1区2区| 色综合欧美在线| 中文字幕精品一区二区三区精品| 日精品一区二区三区| 在线视频一区二区三区| 国产女人18毛片水真多成人如厕| 日韩精品电影一区亚洲| 在线影院国内精品| 中文字幕亚洲不卡| 国产寡妇亲子伦一区二区| 欧美一区二区视频在线观看2022| 国产精品久久久久久户外露出| 美女在线观看视频一区二区| 欧美男男青年gay1069videost| 亚洲女与黑人做爰| 成人一区二区三区| 久久久精品欧美丰满| 老司机精品视频导航| 欧美日韩专区在线| 一卡二卡三卡日韩欧美| 91影院在线观看| 国产精品亲子伦对白| 国产91色综合久久免费分享| 久久亚洲欧美国产精品乐播 | 国产成人av自拍| 久久综合久色欧美综合狠狠| 久久电影国产免费久久电影 | 欧美精品一级二级三级| 亚洲综合另类小说| 欧美亚洲日本国产| 亚洲国产视频网站| 欧美日韩不卡在线| 青青草国产精品97视觉盛宴| 制服丝袜在线91| 日本亚洲免费观看| 日韩欧美一二三| 精品系列免费在线观看| 久久亚洲一区二区三区明星换脸 | 午夜激情久久久| 欧美一区二区三区色| 麻豆国产91在线播放| 精品欧美一区二区三区精品久久| 麻豆成人91精品二区三区| 欧美精品一区二区三区蜜桃视频| 国内精品国产成人国产三级粉色| 欧美精品一区视频| 国产麻豆成人传媒免费观看| 国产欧美日韩精品在线| www.欧美日韩| 亚洲一区欧美一区| 欧美一级欧美一级在线播放| 精品一区二区三区久久| 国产欧美精品区一区二区三区| 成人午夜私人影院| 一区二区三区四区激情| 欧美一区二区视频在线观看2020| 精品一区二区三区蜜桃| 国产精品人人做人人爽人人添| 色老汉一区二区三区| 日精品一区二区| 国产亚洲精品7777| 色老汉一区二区三区| 日本va欧美va精品| 国产欧美精品一区| 欧美三级一区二区| 国产综合色在线视频区| 1024国产精品| 91精品国产欧美日韩| 国产不卡免费视频| 亚洲一二三四久久| 久久综合国产精品| 色哟哟在线观看一区二区三区| 日韩黄色一级片| 亚洲国产精品99久久久久久久久 | 午夜在线成人av| 久久色在线视频| 在线免费观看日韩欧美| 黄页视频在线91| 亚洲视频一区二区在线观看| 6080日韩午夜伦伦午夜伦| 国产精品白丝av| 五月天国产精品| 欧美激情一区二区在线| 欧美日韩国产高清一区二区三区| 黄色资源网久久资源365| 亚洲精品v日韩精品| 欧美精品一区二区久久久| 色综合天天做天天爱| 久久狠狠亚洲综合| 亚洲乱码日产精品bd| 精品国产1区二区| 欧美日韩亚洲国产综合| 国产成人99久久亚洲综合精品| 亚洲成av人片一区二区梦乃 | 亚洲午夜羞羞片| 亚洲国产成人一区二区三区| 欧美蜜桃一区二区三区| 91小视频免费观看| 国产成人自拍网|