SEO | Link Popularity | Search Engine Consulting | SEO Tutorial | SEO Tools | SEO Forum
Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 3.00 average. Display Modes
  #1  
Old 01-30-2006, 12:54 PM
BSolveIT's Avatar
BSolveIT BSolveIT is offline
SEO
 
Join Date: May 2005
Location: England, UK
Posts: 621 BSolveIT has a spectacular aura aboutBSolveIT has a spectacular aura about
Send a message via MSN to BSolveIT
Online Ranking Checks on Google, Yahoo and MSN

Hi!

I've been writing some ASP code to allow our clients to check their rankings fast and easily online through our website. I've integrated Google API, using SOAP and an XML parser, Yahoo API using REST, (they both work like a dream!) but I'm a little stuck on the MSN API, which is SOAP again, but it's a bit trickier than the other two were.

Has anyone here managed to do it? I think my only real problem is the correct format of the SOAP envelope which I construct using XMLDocument:

A snippet from the main function:

Code:
Function MSNResults(gQuery)
If Trim(gQuery) = "" Then Exit Function
Dim Qry 
Set Qry = Server.CreateObject("MSXML2.DOMDocument")
Qry.load Server.MapPath("doMSNSearch.xml")
Qry.selectSingleNode("//Query").Text = gQuery

' Post the SOAP message.
Dim soap
Set soap = Server.CreateObject("MSXML2.ServerXMLHTTP")
soap.open "post", MSNAPI, False
soap.setRequestHeader "Content-Type", "text/xml"
soap.setRequestHeader "SOAPAction", "doMSNSearch"
soap.send Qry ' Dump the results into an XML document.
.
.
.
End Function


Below is what I have of my SOAP envelope so far. It's missing 2 critical bits though. Requests, and SourceRequest. But for the life of me I don't know how to add them - the right format, etc. (XML is not a strength of mine!)

Code:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <SOAP-ENV:Body>
    <ns1:doMSNSearch xmlns:ns1="urn:MSNSearch" 
         SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <AppID xsi:type="xsd:string">API Key Goes Here</AppID>
      <Query xsi:type="xsd:string">Search Terms Here</Query>
      <CultureInfo xsi:type="xsd:string">en-GB</CultureInfo>
      <SafeSearch xsi:type="xsd:string">Off</SafeSearch>
    </ns1:doMSNSearch>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Help... anyone?

Last edited by BSolveIT : 02-02-2006 at 06:36 AM.
Reply With Quote
  #2  
Old 01-30-2006, 01:43 PM
BSolveIT's Avatar
BSolveIT BSolveIT is offline
SEO
 
Join Date: May 2005
Location: England, UK
Posts: 621 BSolveIT has a spectacular aura aboutBSolveIT has a spectacular aura about
Send a message via MSN to BSolveIT
Thumbs up Found my own fix!

Hello again!

Apologies - this is a bit of a duplicate post, but I couldn't decide if this was an MSN related thing, or an ASP thing. Anyway, I solved the problem! This should save a lot fo time and hassle for anyone else implementing MSN Search API in ASP.

A working SOAP envelope:

Code:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
        <ns1:Search xmlns:ns1="http://schemas.microsoft.com/MSNSearch/2005/09/fex">
            <Request>
                <AppID xsi:type="xsd:string">API Key Goes Here</AppID>
                <Query xsi:type="xsd:string">Example Query</Query>
                <CultureInfo xsi:type="xsd:string">en-GB</CultureInfo>
                <SafeSearch xsi:type="xsd:string">Off</SafeSearch>
                <Requests>
                    <SourceRequest>
                        <Source xsi:type="xsd:string">Web</Source>
                        <Offset xsi:type="xsd:int">0</Offset>
                        <Count xsi:type="xsd:int">50</Count>
                        <ResultFields xsi:type="xsd:string">All</ResultFields>
                    </SourceRequest>
                </Requests>
            </Request>
        </ns1:Search>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Obviously you'll need to work out the ASP side of things, POST the SOAP packet, and parse the results - but thats the easy stuff!

Last edited by BSolveIT : 02-02-2006 at 06:35 AM.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Login/Register
User Name
Password
Remember Me?

Forum Links
Forum Home
SEO Forum
Internet Marketing Forum
Web Design Forum
Web Hosting Forum
Programming Forum
SEO Chat

Quick Links
Forum Home
New Posts
Mark Forums Read
Open Buddy List
User Control Panel
Edit Avatar
Edit Profile
Edit Options
Miscellaneous
Subscribed Threads
My Profile

Search Forums

Advanced Search
All times are GMT -8. The time now is 03:27 AM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.