2013-05-06 9 views
2

我正在使用JMeter進行負載測試。我的測試包含一個簡單的POST請求。當我執行此請求時,服務器在其錯誤日誌中說No Payload Detected。我已驗證服務器正在收到Post請求,並且我在Raw Post Body中嘗試了不同的文本。將JMeter與REST Webservice和XML主體一起使用時檢測不到有效負載

接下來,爲了確保它不是服務器的問題,我使用了不同的Http Request程序(Wiztools休息客戶端)發送具有相同內容的帖子。它的工作原理,並沒有No Payload Detected錯誤引發。

我目前的理論是,JMeter和服務器都解析。我知道服務器,因爲它正在尋找一小塊數據,並且JMeter的解析破壞了那小塊數據。

因此,最後,我的問題是「JMeter做什麼解析?」。
我找了這個答案,我知道它唯一解析的是${VARNAME}

我送文如下:

<IpReport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns=""> 
    <ProductReviewId>12345</ProductReviewId> 
    <DepartmentCode>ABC</DepartmentCode> 
    <ProductTitle>Test of a teaser</ProductTitle> 
    <ProjectId>2</ProjectId> 
    <ProductCodePD>ICS-1139150</ProductCodePD> 
    <Priority>Pre-Approved</Priority> 
    <Status>Approved</Status> 
    <IpStatus>Submitted</IpStatus> 
    <EvalStatus>Approved</EvalStatus> 
    <EvalNotes>No Limitations - message from eval</EvalNotes> 
    <Notes>Notes test</Notes> 
    <IsInClarity>true</IsInClarity> 
    <IsPreRelease>true</IsPreRelease> 
    <IsApproved>true</IsApproved> 
    <IsCOREvalIP>false</IsCOREvalIP> 
    <Elements> 
    <IpReportElement> 
     <IpReportElementLineItemId>21774</IpReportElementLineItemId> 
     <ElementType>ReportingStatement</ElementType> 
     <Contributor>Sample Contributor</Contributor> 
     <Description>test</Description> 
     <LocationInProduct>test</LocationInProduct> 
     <ReportingStatementId>7</ReportingStatementId> 
     <IpCodeId>3</IpCodeId> 
     <Links> 
     <IpReportLink> 
      <IpReportLinkId>25982</IpReportLinkId> 
      <Name>Link</Name> 
      <Url>https://example.org/</Url> 
     </IpReportLink> 
     </Links> 
    </IpReportElement> 
    </Elements> 
    <CustomData>&lt;site&gt;ldsorg&lt;/site&gt; 
&lt;site-root&gt;/preview/ldsorg/&lt;/site-root&gt; 
&lt;correlation-document-id&gt;123456-eng&lt;/correlation-document-id&gt; 
&lt;post-to-server&gt;l12773:9239&lt;/post-to-server&gt; 
</CustomData> 
    <ApprovalNumber>2013-1139150-I</ApprovalNumber> 
    <EvalApprovalNumber>2013-1139150-E</EvalApprovalNumber> 
</IpReport> 

這裏是JMeter的的屏幕截圖。這是唯一的要求,沒有其他的配置元素: 所有的JMeter Screenshot

+0

顯示您的HTTP取樣配置 – 2013-05-06 16:41:46

+0

HTTP://img607.imageshack .us/img607/4645/20130506104835telerikvm.png請求的截圖。我已驗證服務器和端口是否正確。我沒有任何配置元素。 – 2013-05-06 16:50:42

+0

你可以在你的問題中添加圖片,我無法顯示鏈接 – 2013-05-06 16:54:41

回答

8

您可能還需要一個HTTP Header Manager添加作爲HTTP Request孩子像設置內容類型一些頭:

Adding an HTTP Header

+0

我不相信它與標題有關,因爲wiztools休息客戶端沒有發送任何標題。 (我也不確定我會用什麼鍵/值) – 2013-05-06 18:29:58

+0

這個答案是正確的。 Content-Type需要成爲application/xml – 2013-05-06 18:44:58

+0

非常感謝!不知道HTTP頭管理器應該作爲一個孩子。當我在採樣器的樹視圖中放置在HTTP採樣器之前時,這對我並不適用。 – 2014-12-08 15:24:15

1
  1. 第一。在你的問題上面,在截圖和請求文本部分的請求都有符號<>編碼和部分 - 沒有。此外,您還使用Content Encoding = UTF-8。似乎在這種情況下,請求將被髮送格式錯誤。
    您可以添加例如View Results Tree監聽器並檢查請求是如何從jmeter發送的。

  2. 您也可以嘗試專用REST Sampler

+0

在我看來,這不需要Rest sampler。 – 2013-05-06 18:18:53

+0

中的信息是重要的信息,我們有意使用&lt;&gt;在結果樹中,請求不會將符號轉換爲<>。 – 2013-05-06 18:24:43

+0

好吧,我只是在查看結果樹中的請求和原始數據上進行比較,看起來它們是相同的。 – 2013-05-06 18:27:41

相關問題