从jmeter调用Ebay API返回:非HTTP响应消息:连接超时:连接

时间:2016-05-19 12:18:04

标签: api jmeter call sandbox ebay

我特别关注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调用正在单独工作。谢谢。

1 个答案:

答案 0 :(得分:0)

再次尝试删除有效负载中的下方并重新发布,我希望它能够正常运行。

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

另请附上jmeter http sampler截图。

调试提示:

  1. 如果它在POST MAN中有效,请尝试查找http原始请求中的差异。 如果您发现任何尝试添加它们在jmeter中添加它们,有时http标头 将错过。

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

    希望它会对你有所帮助。