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

SOAP over HTTP (toolkit implementation), how-to? Specs?

0 views
Skip to first unread message

Spartacus

unread,
Oct 30, 2006, 6:18:53 AM10/30/06
to
Hello fellow API programmers,

I have seen that SOAP XMLRPC is normally done over HTTP, but I am not
sure how to do this with Google's SOAP API.

Is it something along the lines of an HTTP POST with a header
identifying it as a SOAP envelope/document and content-length set to
the POSTed SOAP envelope/XML document? I have looked everywhere I know
for how to implement a SOAP toolkit for Google's SOAP Search API, but
so far no luck. I need details like what server to contact, what
version of HTTP should be used, what headers to include, whether it's a
POST with the POSTed data the SOAP XML document, etc. Can anyone point
me in the right direction?

Also, about the proxy choice. I've seen some demo Perl code that
requires this field, apparently being the Google SOAP server, but
that's not a proxy (strictly speaking), is it? A proxy would be a
"middle man" server sitting between the toolkit and the Google SOAP
server. Would that be correct?

What are the specifications I should read at w3c for SOAP and at Google
for implementing a Google SOAP Search API toolkit?

Thanks for any help.
-Spartacus

Manfred

unread,
Oct 30, 2006, 10:47:17 AM10/30/06
to
> Is it something along the lines of an HTTP POST with a header
> identifying it as a SOAP envelope/document and content-length set to
> the POSTed SOAP envelope/XML document? I have looked everywhere I know
> for how to implement a SOAP toolkit for Google's SOAP Search API, but
> so far no luck. I need details like what server to contact, what
> version of HTTP should be used, what headers to include, whether it's a
> POST with the POSTed data the SOAP XML document, etc. Can anyone point
> me in the right direction?
I use the following:
$headers =
'POST /search/beta2 HTTP/1.1' . $c_eol .
'Host: api.google.com' . $c_eol .
'Content-Type: text/xml; charset=utf-8' . $c_eol .
'Content-Length: ' . strlen($post_data) . $c_eol .
'SOAPAction: urn:GoogleSearchAction' . $c_eol . $c_eol;
with $c_eol = "\r\n";

> What are the specifications I should read at w3c for SOAP and at Google
> for implementing a Google SOAP Search API toolkit?

http://www.w3.org/Protocols/rfc2616/rfc2616.html

Hope this helps,

Manfred

Spartacus

unread,
Oct 31, 2006, 5:42:17 AM10/31/06
to
Manfred wrote:

> I use the following:
> $headers =
> 'POST /search/beta2 HTTP/1.1' . $c_eol .
> 'Host: api.google.com' . $c_eol .
> 'Content-Type: text/xml; charset=utf-8' . $c_eol .
> 'Content-Length: ' . strlen($post_data) . $c_eol .
> 'SOAPAction: urn:GoogleSearchAction' . $c_eol . $c_eol;
> with $c_eol = "\r\n";
>
> > What are the specifications I should read at w3c for SOAP and at Google
> > for implementing a Google SOAP Search API toolkit?
> http://www.w3.org/Protocols/rfc2616/rfc2616.html
>
> Hope this helps,
>
> Manfred

Thank you Manfred! This is a great help.

It works, but I am getting errors about "parsing error:
org.xml.sax.SAXParseException: XML document structures must start and
end within the same entity." But my XML document is good, so I don't
understand why this is happening. I'm using the sample from the SOAP
API development kit with demos that you can download with Google,
unless something's changed and I've got a badly formed SOAP request.
I'll look at the link you gave and see if I can figure it out, but in
the mean time have you had this error and know what the problem might
be?

Thanks again. Really appreciated. :-)

Spartacus

Spartacus

unread,
Oct 31, 2006, 5:55:07 AM10/31/06
to
Incidentally, here is the SOAP request/envelope I sent, just in case
you might spot an error:

<?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:doGoogleSearch xmlns:ns1="urn:GoogleSearch"

SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<key
xsi:type="xsd:string">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</key>
<q xsi:type="xsd:string">Ford%20XR8</q>
<start xsi:type="xsd:int">0</start>
<maxResults xsi:type="xsd:int">100</maxResults>
<filter xsi:type="xsd:boolean">true</filter>
<restrict xsi:type="xsd:string"></restrict>
<safeSearch xsi:type="xsd:boolean">false</safeSearch>
<lr xsi:type="xsd:string"></lr>
<ie xsi:type="xsd:string">latin1</ie>
<oe xsi:type="xsd:string">latin1</oe>
</ns1:doGoogleSearch>

</SOAP-ENV:Body>


</SOAP-ENV:Envelope>


If you have any spare time do you think you could post a known-working
demo doGoogleSearch SOAP envelope so I can compare it to mine?

Thanks again.
Spartacus

Spartacus

unread,
Oct 31, 2006, 6:10:47 AM10/31/06
to
Here are the headers just in case I've made a mistake:

POST /search/beta2 HTTP/1.1
Pragma: no-cache
Accept: */*
Host: api.google.com
Content-Type: text/xml; charset=utf-8
Content-Length: 962
SOAPAction: urn:GoogleSearchAction

I'm using libcurl, so perhaps something odd is happening inside
libcurl, but I doubt it. I wonder if it has something to do with
encoding issues? For example I read in an iso-8859-1 encoded XML
document and send it, declaring it to be UTF-8, although they are
supposed to be compatible. I also could have made an error in passing
libcurl the XML document. I will check that out.

Spartacus

unread,
Oct 31, 2006, 6:32:19 AM10/31/06
to
I didn't url-encode the search term this time, and now it works.

Thanks for your help Manfred. Much appreciated. :)

Best wishes,
Spartacus

0 new messages