Heim >Web-Frontend >js-Tutorial >用JavaScript调用WebService的示例_javascript技巧

用JavaScript调用WebService的示例_javascript技巧

WBOY
WBOYOriginal
2016-05-16 19:05:201050Durchsuche

步骤如下:

下载微软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即可取到值。
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn