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

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

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

    軟件工程實踐者

    統(tǒng)計

    留言簿

    友情鏈結(jié)

    閱讀排行榜

    評論排行榜

    JavaScript調(diào)用Web service

    要調(diào)用的Web服務(wù)是求兩個整數(shù)和,并返回結(jié)果。

    服務(wù)的WSDL文件內(nèi)容如下:
    <?xml version="1.0" encoding="utf-8" ?> 
    <wsdl:definitions
        xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:s="http://www.w3.org/2001/XMLSchema" 
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
        xmlns:tns="http://tempuri.org/"  
        xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
        xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
        targetNamespace="http://tempuri.org/" 
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
         <s:schema elementFormDefault="qualified"  
            targetNamespace="http://tempuri.org/">
            <s:element name="AddTwoIntegers">
                <s:complexType>
                   <s:sequence>  
                      <s:elementminOccurs="1" maxOccurs="1" name="IntegerOne" type="s:int" />    
                      <s:elementminOccurs="1" maxOccurs="1" name="IntegerTwo" type="s:int" />   
                   </s:sequence>
                </s:complexType>
            </s:element>
            <s:element name="AddTwoIntegersResponse">
                <s:complexType>
                    <s:sequence> 
                       <s:elementminOccurs="1" maxOccurs="1" name="AddTwoIntegersResult" type="s:int" />    
                    </s:sequence>
                </s:complexType>
            </s:element>
         </s:schema>
      </wsdl:types>
      <wsdl:message name="AddTwoIntegersSoapIn"> 
          <wsdl:part name="parameters" element="tns:AddTwoIntegers" />
      </wsdl:message>
      <wsdl:message name="AddTwoIntegersSoapOut">  
          <wsdl:part name="parameters" element="tns:AddTwoIntegersResponse" />   
       </wsdl:message>
       <wsdl:portType name="SimpleServiceSoap">
           <wsdl:operation name="AddTwoIntegers">
              <wsdl:input message="tns:AddTwoIntegersSoapIn" />
              <wsdl:output message="tns:AddTwoIntegersSoapOut" />    
           </wsdl:operation> 
       </wsdl:portType>
    
       <wsdl:binding name="SimpleServiceSoap" type="tns:SimpleServiceSoap"> 
           <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> 
           <wsdl:operation name="AddTwoIntegers">   
               <soap:operation soapAction="http://tempuri.org/AddTwoIntegers" style="document" /> 
               <wsdl:input>  
                   <soap:body use="literal" />    
               </wsdl:input>
               <wsdl:output>  
                   <soap:body use="literal" />    
               </wsdl:output>
           </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="SimpleService"> 
          <documentation xmlns="http://schemas.xmlsoap.org/wsdl/" /> 
          <wsdl:port name="SimpleServiceSoap" binding="tns:SimpleServiceSoap">  
              <soap:address location="http://localhost/Develop.NET/Home.Develop.WebServices/SimpleService.asmx"/>  
          </wsdl:port>  
      </wsdl:service> 
    </wsdl:definitions>
    


    javaScript代碼中利用了MS的HTTP代理對象XMLHTTP,在Mozilla's Web brower中相應(yīng)的組件是XMLHttpRequest,他們都提供了類似的方法來完成soap請求。下面的代碼用的是IE中的XMLHTTP對象。代碼假定調(diào)用過程中沒有Fault。
    function fncAddTwoIntegers(a, b)
    {    
        var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP");      
        oXmlHttp.open("POST", "http://localhost/Develop.NET/Home.Develop.WebServices/SimpleService.asmx'", false);
        oXmlHttp.setRequestHeader("Content-Type", "text/xml");    
        oXmlHttp.setRequestHeader("SOAPAction", "http://tempuri.org/AddTwoIntegers");
    
        oXmlHttp.send("      
    <soap:Envelopexmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
    <soap:Body> <AddTwoIntegersxmlns='http://tempuri.org/'> <IntegerOne>" + a + "</IntegerOne> <IntegerTwo>" + b + "</IntegerTwo> </AddTwoIntegers>
    </soap:Body> </soap:Envelope>"); return oXmlHttp.responseXML.selectSingleNode("http://AddTwoIntegersResult").text; }


    原文英文出自:http://builder.com.com/5100-6371_14-5887775.html?tag=nl.e601

    posted on 2006-01-05 20:01 軟件工程實踐者 閱讀(1216) 評論(3)  編輯  收藏 所屬分類: Web service

    評論

    # re: JavaScript調(diào)用Web service 2010-12-06 17:53 你爹

    傻逼  回復(fù)  更多評論   

    # re: JavaScript調(diào)用Web service 2010-12-06 17:54 你爹

    傻逼,不好使  回復(fù)  更多評論   

    # re: JavaScript調(diào)用Web service 2010-12-06 17:54 你爹

    傻逼  回復(fù)  更多評論   


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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 无码av免费网站| 免费观看毛片视频| 狠狠色伊人亚洲综合网站色| 青草草在线视频永久免费| 免费人人潮人人爽一区二区| 久久国产精品亚洲综合| 午夜免费福利在线观看| 中文字幕免费在线看电影大全| 亚洲成综合人影院在院播放| 免费一级肉体全黄毛片| 57pao国产成视频免费播放| 亚洲精品美女久久久久久久| 国产V亚洲V天堂A无码| 毛片a级三毛片免费播放| j8又粗又长又硬又爽免费视频| 亚洲精品国产肉丝袜久久| 四只虎免费永久观看| 99久久久国产精品免费牛牛四川| 久久精品国产亚洲AV电影网| 亚洲va在线va天堂va四虎| 国产成人3p视频免费观看| 100部毛片免费全部播放完整| 免费高清A级毛片在线播放| 亚洲另类春色校园小说| 国产亚洲精品久久久久秋霞 | 热久久这里是精品6免费观看| 亚洲精品人成网在线播放影院| 亚洲伊人久久大香线蕉综合图片| 无码专区永久免费AV网站| 国产免费网站看v片在线| 国产亚洲精品成人久久网站| 亚洲成人免费网站| 国产AV无码专区亚洲精品| 亚洲成a人片在线观看久| 久久这里只有精品国产免费10| 人人玩人人添人人澡免费| 黄色网址大全免费| 在线观看亚洲AV日韩A∨| 亚洲综合图片小说区热久久| 亚洲av无码成h人动漫无遮挡| 亚洲中文字幕无码爆乳av中文|