从 jmeter returns 调用 eBay API:非 HTTP 响应消息:连接超时:连接

Calling eBay API from jmeter returns: Non HTTP response message: Connection timed out: connect

我对 jmeter 和 Ebay 有特别的疑问。 Jmeter 使用不同的 API,eBay 负载使用 Postman 客户端。但我需要从 jmeter 在 eBay 中创建一些项目。使用 jmeter 2.9 和 2.13 同样的结果。

我使用了来自 developer.ebay

的样本

这是jmeter发出的请求:

<!-- language: lang-html -->

POST https://api.sandbox.ebay.com/ws/api.dll

POST data:
<?xml version="1.0" encoding="utf-8"?>
<AddItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>mytoken***</eBayAuthToken>
  </RequesterCredentials>
  <ErrorLanguage>en_US</ErrorLanguage>
  <WarningLevel>High</WarningLevel>
  <Item>
    <Title>Potters Father looks for Anakin</Title>
    <Description>
      This is the first book in the Harry Potter series. In excellent condition!
    </Description>
    <PrimaryCategory>
      <CategoryID>377</CategoryID>
    </PrimaryCategory>
    <StartPrice>1.0</StartPrice>
    <CategoryMappingAllowed>true</CategoryMappingAllowed>
    <ConditionID>4000</ConditionID>
    <Country>US</Country>
    <Currency>USD</Currency>
    <DispatchTimeMax>3</DispatchTimeMax>
    <ListingDuration>Days_7</ListingDuration>
    <ListingType>Chinese</ListingType>
    <PaymentMethods>PayPal</PaymentMethods>
    <PayPalEmailAddress>***@126.com</PayPalEmailAddress>
    <PictureDetails>
      <PictureURL>http://pics.ebay.com/aw/pics/dot_clear.gif</PictureURL>
    </PictureDetails>
    <PostalCode>95125</PostalCode>
    <Quantity>1</Quantity>
    <ReturnPolicy>
      <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
      <RefundOption>MoneyBack</RefundOption>
      <ReturnsWithinOption>Days_30</ReturnsWithinOption>
      <Description>If you are not satisfied, return the book for refund.</Description>
      <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption>
    </ReturnPolicy>
    <ShippingDetails>
      <ShippingType>Flat</ShippingType>
      <ShippingServiceOptions>
        <ShippingServicePriority>1</ShippingServicePriority>
        <ShippingService>USPSMedia</ShippingService>
        <ShippingServiceCost>2.50</ShippingServiceCost>
      </ShippingServiceOptions>
    </ShippingDetails>
    <Site>US</Site>
  </Item>
</AddItemRequest>

[no cookies]

Request Headers:
Connection: keep-alive
Accept: text/xml
Content-Type: application/xml
X-EBAY-API-COMPATIBILITY-LEVEL: 889
X-EBAY-API-CALL-NAME: AddItem
X-EBAY-API-SITEID: 0
X-EBAY-API-DEV-NAME: ***
X-EBAY-API-APP-NAME: ***
X-EBAY-API-CERT-NAME: ***
Content-Length: 2762

这是java返回的堆栈jmeter:

java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.<init>(Unknown Source)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
at org.apache.jmeter.util.HttpSSLProtocolSocketFactory.createSocket(HttpSSLProtocolSocketFactory.java:151)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at org.apache.jmeter.protocol.http.sampler.HTTPHC3Impl.sample(HTTPHC3Impl.java:258)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(Unknown Source)

你有人做过类似的场景吗?我不知道问题出在哪里,jmeter 和示例 addItem 调用的两个部分都在单独工作。谢谢。

通过删除下面的负载再试一次post,我希望它能起作用。

<?xml version="1.0" encoding="utf-8"?> ,

另请附上 jmeter http 采样器截图。

调试提示:

  1. 如果它在 POST MAN 中有效,请尝试找出两者中 http 原始请求的区别。 如果您发现任何尝试添加它们也添加到 jmeter 中,有时 http headers 会错过的。

  2. 检查您的机器是否受防火墙保护?

    希望对您有所帮助。