PDA

View Full Version : QHttp conundrum



Gravis
20th August 2009, 04:14
NOTE: Be sure that if you supply an answer to actually test it against https://api.sandbox.ebay.com/ws/api.dll because I think something fishy is happening.

I can't get QHttp to retrieve (via GET) https://api.sandbox.ebay.com/ws/api.dll. Doing so should yield the following response text(which is exactly what you get if you use a browser to retrieve it).
<?xml version="1.0" encoding="UTF-8" ?><eBay><EBayTime>2009-08-19 23:12:41</EBayTime><Errors><Error><Code>2</Code><ErrorClass>RequestError</ErrorClass><SeverityCode>1</SeverityCode><Severity>SeriousError</Severity><Line>0</Line><Column>0</Column><ShortMessage><![CDATA[ Unsupported verb. ]]></ShortMessage></Error></Errors></eBay> So... why doesnt this code doesnt work?

note: GTest inherits QHttp

void GTest::start(void)
{
QHttpRequestHeader header("GET", "https://api.sandbox.ebay.com/ws/api.dll");
header.setValue("Host", "api.sandbox.ebay.com");
setHost("api.sandbox.ebay.com", QHttp::ConnectionModeHttps);
request(header);
}

I have hooked up all the signals to slots and they give the details of the state of the connection. This is the output i got


RequestStarted() id: 1
RequestFinished()
{
id: 1
error: false
error code: 0
error message: Unknown error
start returned data

end returned data
}
RequestStarted() id: 2
StateChanged() state: 2
StateChanged() state: 3
RequestFinished()
{
id: 2
error: true
error code: 1
error message: HTTP request failed
start returned data

end returned data
}
AllFinished() error: true
StateChanged() state: 6
StateChanged() state: 0


The full code is attached. It's completely stripped down to only do this test.

AcerExtensa
20th August 2009, 12:05
Your code work without any problem....



RequestStarted() id: 1RequestFinished()
{
id: 1
error: false
error code: 0
error message: Unknown error
start returned data

end returned data
}RequestStarted() id: 2StateChanged() state: 2StateChanged() state: 3DataSendProgress() done: 84 total: 84StateChanged() state: 4ResponseHeader()
{
HTTP/1.1 200 OK
Date: Thu, 20 Aug 2009 10:02:38 GMT
Server: Microsoft-IIS/5.0
X-EBAY-API-POOL-NAME: ___cDRidW90YmtiZWx9b2l3aQ==
X-EBAY-API-SERVER-NAME: ___dXYuc3F0YWR2bjM1NygyNSgwLTQ2MS03Nj85PTY/Mg==
Content-Type: text/xml
Content-Length: 330
X-Cache: MISS from sjcsbapigw01.sjc.ebay.com, MISS from sjcsbapigw01.sjc.ebay.com
Connection: close


}DataReadProgress() done: 330 total: 330StateChanged() state: 6StateChanged() state: 0RequestFinished()
{
id: 2
error: false
error code: 0
error message: Unknown error
start returned data
<?xml version="1.0" encoding="UTF-8" ?><eBay><EBayTime>2009-08-20 10:03:53</EBayTime><Errors><Error><Code>2</Code><ErrorClass>RequestError</ErrorClass><SeverityCode>1</SeverityCode><Severity>SeriousError</Severity><Line>0</Line><Column>0</Column><ShortMessage><![CDATA[ Unsupported verb. ]]></ShortMessage></Error></Errors></eBay>
end returned data
}AllFinished() error: false