Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

eBay with Indy

92 views
Skip to first unread message

Michael Horne

unread,
Jul 25, 2005, 11:41:20 PM7/25/05
to
Hello,

I am trying to connect to ebay and download information
using Indy 9, Delphi 7, and their XML interface. Has
anyone been successful.

I can make the connection and pass information but
ebay returns an error message.

I am hopefull that someone in this news group will have
some sample code they would be willing to share.

Thanks
Michael

Remy Lebeau (TeamB)

unread,
Jul 26, 2005, 12:58:04 PM7/26/05
to

"Michael Horne" <g...@pobox.com> wrote in message
news:p2cbe197a50nkv75q...@4ax.com...

> I can make the connection and pass information but
> ebay returns an error message.

Please elaborate. What does your actual code look like? What error message
is being reported?


Gambit


Michael Horne

unread,
Jul 26, 2005, 2:08:26 PM7/26/05
to
Hello,

The test program I have written does connect and
communicate with ebay, but ebay returns an error
message saying that there is an "Unsupported verb".
Which I have been unable to get past.

The problem seems to be that ebay's api interface
is not working correctly with Indy. EBay requires
specific custom headers which I have tested to
make sure that Indy is sending. I even supplied
a copy of the program to a by connecting to an
http server that I have and checking what headers
are transmitted. An ebay support programmer who
I sent the program to also confirmed that the headers
are being sent.

The ebay support programmer's response was:
>>I'm digging around for Delphi 7 so that I can debug on my end. :)
>>The problem lies in how the request and the headers are
>>formatted (where quotes, newlines, etc are placed).
>>Try experimenting with the order of the custom headers
>>and if that does not work then with 1 or 2 CR/LF characters at
>>the end of the last header.
>>Try with and without single quotes also on some of the headers.
>>It may also be a request length problem or some other behavior
>>with the internet component.
>>If I can get a hold of Delph 7, I will surely try to find the solution
>>myself.

>>What is interesting is that the ASP (Microsoft Active Server
>>Pages) processing DLL has no problem capturing the request
>>correctly so this is unique to our API architecture communicating
>>with the Deplhi request.

I have tried all their suggestions but cannot seem
to make it work. So this morning I installed Indy 10
to see if it would help, it did not.

Since the program has passwords for testing with
ebay in it, I don't want to post it to the news group
but if you wish I will send a copy to you.

The point I am currently at is trying to use WinInet
and see if I can get it to work with it. But I would MUCH
prefer to do this with Indy.

Thanks
Michael

Remy Lebeau (TeamB)

unread,
Jul 26, 2005, 3:22:25 PM7/26/05
to

"Michael Horne" <g...@pobox.com> wrote in message
news:16uce1h42df1ord2i...@4ax.com...

> The test program I have written does connect and
> communicate with ebay, but ebay returns an error
> message saying that there is an "Unsupported verb".
> Which I have been unable to get past.

Again, I ask you to please show your ACTUAL code, and the ACTUAL error
message. You are obviously doing something that eBay does not support, but
without seeing what you are actually doing, nobody can tell you how to make
it work.


Gambit


Michael Horne

unread,
Jul 26, 2005, 4:33:04 PM7/26/05
to
ok, Below with the secure keys changed slightly,
write to me for the full source and executable
that contains them.

Thanks
Michael

-------------------------program code --------------------

var transmission:TStringList;
s, url:String;
begin
try
idHTTP.Request.CustomHeaders.Clear;

idHTTP.Request.CustomHeaders.Values['X-EBAY-API-SESSION-CERTIFICATE']
:='''xxxxxxxxL44479DU77JW1KPU127QF4;xxxxxxxxQUV8S1VKIZJYDAEKWJI718;xxxxxxxxJ57$Y11N41H18-1BJ2MR22''';

idHTTP.Request.CustomHeaders.Values['X-EBAY-API-COMPATIBILITY-LEVEL']
:='415';
idHTTP.Request.CustomHeaders.Values['X-EBAY-API-DEV-NAME']
:='''xxxxxxxxL44479DU77JW1KPU127QF4''';
idHTTP.Request.CustomHeaders.Values['X-EBAY-API-APP-NAME']
:='''xxxxxxxxQUV8S1VKIZJYDAEKWJI718''';
idHTTP.Request.CustomHeaders.Values['X-EBAY-API-CERT-NAME']
:='''xxxxxxxxJ57$Y11N41H18-1BJ2MR22''';
idHTTP.Request.CustomHeaders.Values['X-EBAY-API-SITEID'] :='0';
idHTTP.Request.CustomHeaders.Values['X-EBAY-API-CALL-NAME']
:='''GeteBayOfficialTime''';
idHTTP.Request.CustomHeaders.Values['X-EBAY-API-DETAIL-LEVEL']
:='0';

transmission:=tStringlist.Create;
try
// Load the Command to send
transmission.Text:=mXMLSend.Text; // this is the XML command
// Load the URL to send
url:='https://api.sandbox.ebay.com/ws/api.dll';
try
// Send the request
s:=idHTTP.Post(url,transmission);
// change all '>' to '>'+CRLF to make it easer to read the
results
s := StringReplace(s, '>', '>'+#13#10, [rfReplaceAll]);
// Display the results
mXMLReceive.Text := s;
except
// handle any errors
on E: Exception do
begin
Log('Exception - '+s, clRed);
Log('----'+#13#10+e.Message+#13#10+'----', clRed);
end;
end;
finally
end;
end;


------------------------XML Command Sent --------------------
<?xml version="1.0" encoding="utf-8" ?>
<request>

<RequestToken>xxxxxxxxxxxxxxxxxxxxxxxxxxmdj6wVnY+sEZ2PrA2dj6wJnY+lCpaAowWdj6x9nY+seQ**iVQAAA**AAMAAA**OsOeECfTXXGNrQlw8Bw7ZsrSgrByCKwj04IgY+pDRFIyv5qwQgVzvCN5IALuZc2x84qgXoTf6058ex5QRrba4PkeYo9Jzr6J3gCDkseAWjjM3Ny5F5Fcbq8Jl+s2k4Vku0s0pygKhufva2fNUAgpt3nbmG//iA4CdGmpc3FAVhg6KBpdDEzKCTyz8rkbPa0TuQyeV9mzZewxUFWS+DSzq4iDgF/xRFkX5ddPmQ6CmW4+wimN+QlUNgHICXyvHqCo6ijvlyQz70XCk/u4rYBNtlXUTStw0uYDu9tkNgNSDKNWbtFMdLKNnObjc/G6DAWS3HCCKDUpGgVuKGBIvE9EfSd7MbIgFD8PoWIxW6cfOQsKUK5AZfaDBi2wCoBUxmbK1J9fjHmroctUVXgMZ8gqOcIfAuG5XiuTH++aADy/xJpjbhP++BA47qv8K0iJyDFLA4K18uzx8f+gkgAG57b+/9FljOrIM1V+HoBQiHQTCHJIBblFLZQTeJZSfo9gUj0hZOVVhqCD97i8WcNoHyafkT+/W4ZGRM1bN3dtwZcdp0qbB4WRiOgfssX9ba+hWR9rEt2kLeahytkp0z3MGXAE3ZwWM+5iDNvschKSBhVAruHHzJeq6MnhLPKzogPR8Y2rGkmI5aMzXXa/1DXO5ZgfWcrIkNdlKrqBjpEfykCwsLHVGD+KdR73k5CHiISXZyJrguwi8Yclgk6ZcaTf6CQQ53E0kTzYG60eC9rngvVUURb5QMGMCWohqX8XM1GFZtkQ</RequestToken>
<ErrorLevel>1</ErrorLevel>
<Verb>GeteBayOfficialTime</Verb>
<DetailLevel>0</DetailLevel>
<SiteId>0</SiteId>
</request>


------------------------Results --------------------
<?xml version="1.0" encoding="utf-8" ?>
<eBay>
<EBayTime>
2005-07-26 20:25:52</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>

Remy Lebeau (TeamB)

unread,
Jul 27, 2005, 2:24:08 PM7/27/05
to

"Michael Horne" <g...@pobox.com> wrote in message
news:mq6de1tp4089cnc13...@4ax.com...

> idHTTP.Request.CustomHeaders.Values['X-EBAY-API-SESSION-CERTIFICATE']
>
:='''xxxxxxxxL44479DU77JW1KPU127QF4;xxxxxxxxQUV8S1VKIZJYDAEKWJI718;xxxxxxxxJ
57$Y11N41H18-1BJ2MR22''';

Why do you have extra quotation marks around that string? Get rid of them.

> idHTTP.Request.CustomHeaders.Values['X-EBAY-API-DEV-NAME']
> :='''xxxxxxxxL44479DU77JW1KPU127QF4''';

Likewise.

> idHTTP.Request.CustomHeaders.Values['X-EBAY-API-APP-NAME']
> :='''xxxxxxxxQUV8S1VKIZJYDAEKWJI718''';

Likewise.

> idHTTP.Request.CustomHeaders.Values['X-EBAY-API-CERT-NAME']
> :='''xxxxxxxxJ57$Y11N41H18-1BJ2MR22''';

Likewise.

> idHTTP.Request.CustomHeaders.Values['X-EBAY-API-CALL-NAME']
> :='''GeteBayOfficialTime''';

Likewise.

Also, this particular value is likely contributing to your problem, because
the header value *does not* exactly match the <Verb> in your request.
According to eBay's documentation:

"The value specified within the Verb tag must match the value passed in
the X-EBAY-API-CALL-NAME header that accompanies the call."

Since they do not exactly match, eBay is likely not able to figure out which
Verb you are actually trying to execute.

> // Load the URL to send
> url:='https://api.sandbox.ebay.com/ws/api.dll';

I am assuming that you have connected an SSL IOHandler to the TIdHTTP
object, correct?

> s:=idHTTP.Post(url,transmission);

You are sending the XML as a TStrings. Post() modifies the contents of a
TStrings. TStrings is typically only to be used when submitting values for
an HTML <form>. To send the XML unaltered, you should be using a TStream
instead, such as TStringStream.

> <Verb>GeteBayOfficialTime</Verb>

For what it is worth, you are using eBay's *old* XML API, which will stop
working in June 2006. Have you tried updating your code to eBay's newer XML
API yet?


Gambit


Michael Horne

unread,
Jul 27, 2005, 4:37:12 PM7/27/05
to
Hello Remy,

Well it seems be working now, the fix was in using the TStringStream
for the post. Also, I had to remove the quotes from around the
headers.

The quotes where around the headers because I was getting an error
message of:
<![CDATA[XML Parse error.]]>
until I put them there, but with removing the quotes and using
TStringStream it now works.

I am going to create a nice demo and post the source here for others
to use.

Thanks
Michael

0 new messages