zoukankan      html  css  js  c++  java
  • ajax 异步请求webservice(XML格式)

    function callAjaxWebservice(){
    				alert("call ajax");
                     try {
                         $.ajax({
                             type: "POST",  //访问WebService使用post方式请求
                             contentType: "text/xml;utf-8",//使用的xml格式的
                             url: "http://192.168.6.176:8899/arch/entry/services/CheckLogin", //调用WebService的地址和方法名称组合
                             data: getPostData(),  //这里是要传递的参数
                             dataType: "xml",  //参数类型为xml
                             success: function (result) {
                                 alert("call succ:"+result);
                             },
                             error: function(res,err){
                             	alert("call failed:"+res.responseText);
                             }
                         })
                     }
                     catch (ex) {
                         alert(ex);
                     }
    }
    
    function getPostData(){
    	var data="<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.checklogin.assetpda.business/">"+
    		  "<soapenv:Header/>" +
    		  "<soapenv:Body>"  +
    		      "<ser:validUser>" +		         		         		         
    		         "<arg0>wu</arg0><arg1>1234</arg1>" +
    		       "</ser:validUser>" +
    		   "</soapenv:Body>" + 
    		  "</soapenv:Envelope>";
    
    
    	return data;
    }
    
  • 相关阅读:
    2021-5-14 日报博客
    2021-5-13 日报博客
    2021-5-11 日报博客
    2021-5-10 日报博客
    2021-5-8 周报博客
    团队介绍——北部大队
    周总结4
    梦断代码阅读笔记02
    周总结3
    周总结2
  • 原文地址:https://www.cnblogs.com/yjl49/p/3584893.html
Copyright © 2011-2022 走看看