Forum Moderators: DixonJones

Message Too Old, No Replies

IndexTools API Example ?

         

clolsen

10:07 am on Feb 19, 2009 (gmt 0)

10+ Year Member



I am new to IndexTools, and would like to use the API. I have all the documentation, and I've implemented the API as I believe it should.

Still not working though, and my distributor don't have any samples.

So: anyone out there who has a (simple) working example of accessing IndexTools through the API ? Preferably in Visual Studio C#, but I'll be happy with pretty much anything.

BTW - this is what I have done (sans the usernames / passwords), in case anyone should be interested:

string data =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> " +
" " +
" <soapenv:Body> " +
" <Login xmlns=\"http://v3.soap.api.indextools.com\"> " +
" <PartnerId>#*$!XX</PartnerId> " +
" <PartnerPassword>YYYYYY</PartnerPassword> " +
" <UserId>ZZZZZ</UserId> " +
" <UserPassword>QQQQQ</UserPassword> " +
" <secure>true</secure> " +
" </Login> " +
" </soapenv:Body> ";

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URI);
request.Method = WebRequestMethods.Http.Post;

request.ContentLength = data.Length;
request.ContentType = "application/x-www-form-urlencoded";

StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(data);
writer.Close();

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string tmp = reader.ReadToEnd();
response.Close();
label1.Text = tmp;

clolsen

11:58 am on Feb 19, 2009 (gmt 0)

10+ Year Member



I missed the WDSL file in the documentation. This should take are of the problem - please disregard this post.