HTTP POST和GET的區(qū)別
1、HTTP 只有POST和GET 兩種命令模式;
2、POST是被設(shè)計用來向上放東西的,而GET是被設(shè)計用來從服務(wù)器取東西的,GET也能夠向服務(wù)器傳送較少的數(shù)據(jù),而Get之所以也能傳送數(shù)據(jù),只是用來設(shè)計告訴服務(wù)器,你到底需要什么樣的數(shù)據(jù).POST的信息作為HTTP 請求的內(nèi)容,而GET是在HTTP 頭部傳輸?shù)模?
3、POST與GET在HTTP 中傳送的方式不同,GET的參數(shù)是在HTTP 的頭部傳送的,而Post的數(shù)據(jù)則是在HTTP 請求的內(nèi)容里傳送;
4、POST傳輸數(shù)據(jù)時,不需要在URL中顯示出來,而GET方法要在URL中顯示;
5、GET方法由于受到URL長度的限制,只能傳遞大約1024字節(jié);POST傳輸?shù)臄?shù)據(jù)量大,可以達(dá)到2M,而根據(jù)微軟方面的說法,微軟對用 Request.Form() 可接收的最大數(shù)據(jù)有限制,IIS 4 中為 80 KB 字節(jié),IIS 5 中為 100 KB 字節(jié);
6、SOAP是依賴于HTTP POST模式實現(xiàn)的;
例子:
HTTP GET
發(fā)送
GET /DEMOWebServices2.8/Service.asmx/CancelOrder?UserID=string&PWD=string&OrderConfirmation=string HTTP/1.1
Host: api.efxnow.com
回復(fù)
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<objPlaceOrderResponse xmlns="https://api.efxnow.com/webservices2.3">
<Success>boolean</Success>
<ErrorDescription>string</ErrorDescription>
<ErrorNumber>int</ErrorNumber>
<CustomerOrderReference>long</CustomerOrderReference>
<OrderConfirmation>string</OrderConfirmation>
<CustomerDealRef>string</CustomerDealRef>
</objPlaceOrderResponse>
HTTP POST
發(fā)送
POST /DEMOWebServices2.8/Service.asmx/CancelOrder HTTP/1.1
Host: api.efxnow.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
UserID=string&PWD=string&OrderConfirmation=string
回復(fù)
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<objPlaceOrderResponse xmlns="https://api.efxnow.com/webservices2.3">
<Success>boolean</Success>
<ErrorDescription>string</ErrorDescription>
<ErrorNumber>int</ErrorNumber>
<CustomerOrderReference>long</CustomerOrderReference>
<OrderConfirmation>string</OrderConfirmation>
<CustomerDealRef>string</CustomerDealRef>
</objPlaceOrderResponse>
SOAP 1.2
發(fā)送
POST /DEMOWebServices2.8/Service.asmx HTTP/1.1
Host: api.efxnow.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CancelOrder xmlns="https://api.efxnow.com/webservices2.3">
<UserID>string</UserID>
<PWD>string</PWD>
<OrderConfirmation>string</OrderConfirmation>
</CancelOrder>
</soap12:Body>
</soap12:Envelope>
回復(fù)
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CancelOrderResponse xmlns="https://api.efxnow.com/webservices2.3">
<CancelOrderResult>
<Success>boolean</Success>
<ErrorDescription>string</ErrorDescription>
<ErrorNumber>int</ErrorNumber>
<CustomerOrderReference>long</CustomerOrderReference>
<OrderConfirmation>string</OrderConfirmation>
<CustomerDealRef>string</CustomerDealRef>
</CancelOrderResult>
</CancelOrderResponse>
</soap12:Body>
</soap12:Envelope>
posted on 2008-05-29 15:33 肥仔 閱讀(8652) 評論(2) 編輯 收藏 引用 所屬分類: HTTP & URL