Rumah >hujung hadapan web >tutorial js >用JavaScript调用WebService的示例_javascript技巧

用JavaScript调用WebService的示例_javascript技巧

WBOY
WBOYasal
2016-05-16 19:05:201057semak imbas

步骤如下:

下载微软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即可取到值。
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn