在Postman用post方式請求webapi


post方式訪問webapi(參數巨大)

  • 具體postman設置見圖,其他tabs默認就好。選raw后貼入鍵值對diagnosisTable=[...]選post點send即可。

怎么格式化返回的json? 選json即可


不用postman自己用jQuery實現一個post請求工具

  • 讓chrome支持跨域訪問:

chrome圖標上右鍵屬性的目標改成"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=D:\work\chromeTemp\

  • 然后在跨域chrome中訪問如下頁面,注意api改成自己的,內容格式a=123&b=123
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
	$("button").click(function(){
		$('#div1').html('發送成功!');
		var a=$('#a').val();
		var b=$('#b').val();
		 $.post(
			a,
			b ,
			function(rlt,status,xhr){
				$('#div1').html(rlt); 
		})   
	});
});
</script>
api:<input type='text' style='width:1010px' id='a' value='http://localhost:5383/webapi/SysMgr/GetSrvDateTime'/><br> <br> 
post內容:<br> 
<textarea rows="20" cols="150" id='b'></textarea><br> <br> 
	<div id='div1'>執行結果</div> 
</head>
<body> 
<button>發送POST請求</button>

postman發起soap請求(調用webservice接口)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM