我試圖通過POSTMAN
chrome擴展發送SOAP
請求。我的要求身體在POSTMAN
中看起來像這樣。如何通過POSTMAN發送SOAP請求
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://partnerapi.somewhere.com/"> <soapenv:Body> <ns1:GetCustomers> <GetCustomersRequest> <APIKey>SECRET</APIKey> <PartnerKey></PartnerKey>
<SearchText></SearchText> <ItemsPerPage>50</ItemsPerPage> <PageNumber>1</PageNumber> <Fields></Fields> <OrderBy></OrderBy> </GetCustomersRequest> </ns1:GetCustomers> </soapenv:Body> </soapenv:Envelope>
編輯:
點擊在POSTMAN
的Generate Code
按鈕提供了以下片段:
POST /PartnerAPI.asmx HTTP/1.1 Host: localhost:3000 Content-Type: text/xml SOAPAction: http://partnerapi.somewhere.com/GetCustomers Cache-Control: no-cache Postman-Token: 1af78251-9d36-0c94-d0e3-21f7e37ffc41
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://partnerapi.somewhere.com/"> <soapenv:Body> <ns1:GetCustomers> <GetCustomersRequest> <APIKey>SECRET</APIKey> <PartnerKey></PartnerKey>
<SearchText></SearchText> <ItemsPerPage>50</ItemsPerPage> <PageNumber>1</PageNumber> <Fields></Fields> <OrderBy></OrderBy> </GetCustomersRequest> </ns1:GetCustomers> </soapenv:Body> </soapenv:Envelope>
我在Visual Studio
運行的Web服務,我有一個斷點設置在正在命中的Web方法中,以便重新請求痛苦的終點。
Web方法的簽名是這樣的: [WebMethod] public CustomersObject GetCustomers(RequestObjects.GetCustomersRequest GetCustomersRequest)
但GetCustomersRequest
參數始終是NULL。
的GetCustomersRequest
類看起來像這樣
public class GetCustomersRequest
{
public string APIKey;
public string PartnerKey;
public string SearchText;
public int ItemsPerPage = 50;
public int PageNumber = 1;
public string Fields;
public string OrderBy;
}
任何想法,爲什麼?
您顯示了您的請求正文,但請求的其餘部分如何?在Postman中,如果你點擊「生成代碼」並粘貼到這裏,它可能會更有幫助。 – SiKing
@SiKing我按照建議添加了「生成代碼」按鈕生成的代碼片段 –