<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    andyj2ee

    java tec sky

    統計

    留言簿(4)

    activemq

    aop

    design pattern

    other blog

    spring

    workflow

    多線程

    軟件架構師

    閱讀排行榜

    評論排行榜

    jsp 調用webservice 實例

    安裝Axis (Install Axis)

     

    1.  Download axis-1_1-src.tar

    http://ws.apache.org/axis/

    http://ws.apache.org/axis/download.cgi

    2.  unpack to d:/axis-1_1

    3.配置系統環境變量

    Windows:
    set AXIS_HOME=D:\opensource\axis\axis-1_1
    set AXIS_LIB=%AXIS_HOME%\lib
    set AXISCLASSPATH=%AXIS_LIB%\axis.jar;
    %AXIS_LIB%\commons-discovery.jar;
    %AXIS_LIB%\commons-logging.jar;
    %AXIS_LIB%\jaxrpc.jar;
    %AXIS_LIB%\saajjar;
    %AXIS_LIB%\log4j-1.2.8.jar;
    %AXIS_LIB%\saaj.jar;
    %AXIS_LIB%\wsdl4j.jar;


    How to use WSDL2Java

    Given a WSDL file of a web service you can manually code a client based on your understanding of WSDL document or you can use a tool to do that for you. This is very handy when WSDL is very complex. Axis provides such tool. Here is the command that you can run on GoogleSeach.wsdl.

    java org.apache.axis.wsdl.WSDL2Java --verbose GoogleSearch.wsdl

    Make sure that you have axis.jar file in your classpath while executing this command, as that is where org.apache.axis.wsdl.WSDL2Java resides.

    You will find a number of .java files generated in a subdirectory named GoogleSearch. These are the stub files or wrapper classes. The wrapper classes allow you to code in java data types and convert them transparently to XML.

    在網上google 一個有效的wsdl:
    http://www.webservicex.com/stockquote.asmx?WSDL

    生成java 類
    D:\projects\test\webservice\src>java org.apache.axis.wsdl.WSDL2Java --verbose http://www.webservicex.com/stockquote.asmx?WSDL

    Parsing XML file:  http://www.webservicex.com/stockquote.asmx?WSDL
    Generating NET\webserviceX\www\StockQuote.java
    Generating NET\webserviceX\www\StockQuoteLocator.java
    Generating NET\webserviceX\www\StockQuoteSoap.java
    Generating NET\webserviceX\www\StockQuoteSoapStub.java

    建立工程寫 java test
    import NET.webserviceX.www.StockQuoteLocator;
    import NET.webserviceX.www.StockQuoteSoap;


    /**
     * @author andy.zhang
     
    */

    public class Test {
        
    public static void main(String[] arg){
            StockQuoteLocator binding
    =new StockQuoteLocator();
               
    try {
                    StockQuoteSoap port
    =binding.getStockQuoteSoap();
                    String str
    =port.getQuote("IBM");
                    System.
    out.println(str);
               }

               
    catch(Exception e){
               }

        }

    }




    運行測試:
    D:\projects\test\webservice\classes>java -classpath %classpath%;.;NET.webservice
    X.www.*; Test

    <StockQuotes>
        
    <Stock>
            
    <Symbol>IBM</Symbol>
            
    <Last>92.37</Last>        
            
    <Date>3/4/2005</Date>
            
    <Time>4:00pm</Time>
            
    <Change>-0.04</Change>
            
    <Open>92.94</Open>
            
    <High>93.18</High>
            
    <Low>92.36</Low>
            
    <Volume>4754000</Volume>
            
    <MktCap>150.8B</MktCap>
            
    <PreviousClose>92.41</PreviousClose>
            
    <PercentageChange>-0.04%</PercentageChange>
            
    <AnnRange>81.90 - 99.10</AnnRange>
            
    <Earns>4.94</Earns>
            
    <P-E>18.71</P-E>
            
    <Name>INTL BUSINESS MAC</Name>
        
    </Stock>
    </StockQuotes>



    D:\projects\test\webservice\classes>
    成功了。:)


    這樣,就完成了對.NET WebService端的調用。

    (data filetype:mdb)




    方向:分布式系統設計

    posted on 2005-03-07 15:52 java光環 閱讀(5827) 評論(3)  編輯  收藏 所屬分類: webservice

    評論

    # re: jsp 調用webservice 實例 2005-03-07 19:00 candy_liu

    好文章!
    補充一下:
    對方的wsdl 文件
    就是xml 文件,在文件中說明了,這個webservice 提供了那些方法可以調用。
    然后 生成工具根據 wsdl文件 的描述,生成相應的骨架代碼

    用骨架代碼 就能寫程序了
      回復  更多評論   

    # re: jsp 調用webservice 實例 2005-11-25 11:56 Ray

    好好啊!
    受益匪淺!  回復  更多評論   

    # re: jsp 調用webservice 實例 2006-12-11 16:50 a[匿名]

    請問,我用JBUILDER2006自動生成客戶端然后在想在JSP中調用,可是總是不能實例化類是為什么,如果不能實例化類那怎么調用里面的方法取出來數值呢  回復  更多評論   


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 免费人成在线观看网站品爱网| caoporn国产精品免费| 日韩精品在线免费观看| 国外亚洲成AV人片在线观看| 一级做α爱过程免费视频| 午夜亚洲福利在线老司机| 特级毛片爽www免费版| www亚洲一级视频com| 成人精品综合免费视频| 亚洲毛片av日韩av无码| 99免费精品视频| 久久亚洲AV午夜福利精品一区 | 亚洲人妻av伦理| 一区二区免费电影| 国产亚洲一区二区三区在线观看| 你懂的免费在线观看网站| 亚洲最大中文字幕| 女人毛片a级大学毛片免费| 亚洲av日韩av永久无码电影| 2022中文字字幕久亚洲| 午夜网站在线观看免费完整高清观看 | 亚洲av永久无码精品三区在线4| 免费毛片在线看片免费丝瓜视频 | 国产黄色片在线免费观看| 美女羞羞视频免费网站| 中文字幕亚洲无线码| 91精品国产免费久久国语麻豆| 久久亚洲国产最新网站| www.亚洲一区| 久视频精品免费观看99| 国产综合成人亚洲区| 亚洲精品国产精品乱码不99| 99久久久精品免费观看国产| 久久精品国产亚洲av瑜伽| 亚洲精品无码久久久久去q | 久久久久久曰本AV免费免费| 日韩在线视精品在亚洲| 亚洲产国偷V产偷V自拍色戒| 亚洲第一成年免费网站| 成人爽a毛片免费| 亚洲精品无码aⅴ中文字幕蜜桃|