首页  >  文章  >  web前端  >  用JavaScript调用WebService的示例_javascript技巧

用JavaScript调用WebService的示例_javascript技巧

WBOY
WBOY原创
2016-05-16 19:05:201023浏览

步骤如下:

下载微软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