首頁 >web前端 >js教程 >用JavaScript调用WebService的示例_javascript技巧

用JavaScript调用WebService的示例_javascript技巧

WBOY
WBOY原創
2016-05-16 19:05:201050瀏覽

步骤如下:

下载微软HTC组件:http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/samples/internet/behaviors/library/webservice/default.asp

Web服务WSDL:



    
        http://192.168.2.148:8080/SCRM4U_SERVICE/servlet/HLP_PWS_SYSTEM_LOGIN_SELECT.htm
        ?
    

    
        
            
                
                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                    
                    

                

            

            
                
                    
                        
                        
                    

                

            

            
                
                    
                        
                    

                

            

        

    

    
        
    

    
        
    

    
        
            
            
        

    

    
        
        
            
            
                
            
            
                
            

        

    

    
        
            


        
    


演示代码:




<script>... <BR>function doService(userid, password) ...{ <br><br> //service.useService({webservice location},{webservice class name}) <BR> service.useService("http://192.168.2.148:8080/SCRM4U_SERVICE/servlet/aws_system_login_select?wsdl","WS_SYSTEM_LOGIN_SELECT"); <BR> //service.Service.callService({webmethod},{input parameters needed}) <BR> service.WS_SYSTEM_LOGIN_SELECT.callService(showResult, "Execute", userid, password); <BR>} <br><br>function showResult(result)...{ <br><br> alert(result.value.W_V_USER_MEI); <BR>} <BR></script>


UserName:


PassWord:





注意:如果服务返回值类型是String,直接用result.value即可取到值。
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn