// WARNING: automatically generated by the OIL2 class WSDLtoOIL2 %include class Experimental . GoogleSearchService { /*! Automatically generated by class=WSDLtoOIL2. !*/ string targetURL; } inherits from SOAPservice, XMLsupport; GoogleSearchService:create() { targetURL = "http://api.google.com/search/beta2"; } GoogleSearchService:_encode_doGetCachedPage(string keyARG, string urlARG) { set xmlLines; string result; any paramLine; paramLine = call "getSOAPenvelopeHeader"("doGetCachedPage", "urn:GoogleSearch", "http://schemas.xmlsoap.org/soap/encoding/"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(keyARG, "key", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(urlARG, "url", "xsd:string"); xmlLines |= paramLine; paramLine = call "getSOAPenvelopeClosing"("doGetCachedPage"); xmlLines |= paramLine; result = makeAsString(xmlLines); return (result); } GoogleSearchService:_decode_doGetCachedPageResponse(array xmlParse) { assoc result; any elem; for elem in xmlParse[0] do { if (elem[1] == "return") { result["return"] = base64ToASCII(elem[2]); } } return (result); } GoogleSearchService:doGetCachedPage(string keyARG, string urlARG) { /*! Top-level RPC-style invocation. !*/ string packet; int rc; any result, response; packet = call "_encode_doGetCachedPage"(arrayToSet(argv)); rc = call "issueRequest"(targetURL, packet); response = call "receiveResponse"(); if (response == nil) return (nil); result = call "_decode_doGetCachedPageResponse"(response); return(result); } GoogleSearchService:_encode_doSpellingSuggestion(string keyARG, string phraseARG) { set xmlLines; string result; any paramLine; paramLine = call "getSOAPenvelopeHeader"("doSpellingSuggestion", "urn:GoogleSearch", "http://schemas.xmlsoap.org/soap/encoding/"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(keyARG, "key", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(phraseARG, "phrase", "xsd:string"); xmlLines |= paramLine; paramLine = call "getSOAPenvelopeClosing"("doSpellingSuggestion"); xmlLines |= paramLine; result = makeAsString(xmlLines); return (result); } GoogleSearchService:_decode_doSpellingSuggestionResponse(array xmlParse) { assoc result; any elem; for elem in xmlParse[0] do { if (elem[1] == "return") { result["return"] = elem[2]; } } return (result); } GoogleSearchService:doSpellingSuggestion(string keyARG, string phraseARG) { /*! Top-level RPC-style invocation. !*/ string packet; int rc; any result, response; packet = call "_encode_doSpellingSuggestion"(arrayToSet(argv)); rc = call "issueRequest"(targetURL, packet); response = call "receiveResponse"(); if (response == nil) return (nil); result = call "_decode_doSpellingSuggestionResponse"(response); return(result); } GoogleSearchService:_encode_doGoogleSearch(string keyARG, string qARG, int startARG, int maxResultsARG, int filterARG, string restrictARG, int safeSearchARG, string lrARG, string ieARG, string oeARG) { set xmlLines; string result; any paramLine; paramLine = call "getSOAPenvelopeHeader"("doGoogleSearch", "urn:GoogleSearch", "http://schemas.xmlsoap.org/soap/encoding/"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(keyARG, "key", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(qARG, "q", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(startARG, "start", "xsd:int"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(maxResultsARG, "maxResults", "xsd:int"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(filterARG, "filter", "xsd:boolean"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(restrictARG, "restrict", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(safeSearchARG, "safeSearch", "xsd:boolean"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(lrARG, "lr", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(ieARG, "ie", "xsd:string"); xmlLines |= paramLine; paramLine = call "convertBasicTypeToXML"(oeARG, "oe", "xsd:string"); xmlLines |= paramLine; paramLine = call "getSOAPenvelopeClosing"("doGoogleSearch"); xmlLines |= paramLine; result = makeAsString(xmlLines); return (result); } GoogleSearchService:_decode_doGoogleSearchResponse(array xmlParse) { assoc result; any elem; for elem in xmlParse[0] do { if (elem[1] == "return") { result["return"] = call "_decodeComplex_GoogleSearchResult"(elem); } } return (result); } GoogleSearchService:doGoogleSearch(string keyARG, string qARG, int startARG, int maxResultsARG, int filterARG, string restrictARG, int safeSearchARG, string lrARG, string ieARG, string oeARG) { /*! Top-level RPC-style invocation. !*/ string packet; int rc; any result, response; packet = call "_encode_doGoogleSearch"(arrayToSet(argv)); rc = call "issueRequest"(targetURL, packet); response = call "receiveResponse"(); if (response == nil) return (nil); result = call "_decode_doGoogleSearchResponse"(response); return(result); } GoogleSearchService:_decodeComplex_ResultElementArray(array xmlParse) // _outputComplexDecodeMethod { assoc result, attr; array resultArray; int count; any elem, subElem, complexResult; for elem in xmlParse[0] do { // xsd:complexContent _outputConversionFromXML array=1 resultArray[count] = call "_decodeComplex_ResultElement"(elem); count += 1; } return (resultArray); } GoogleSearchService:_decodeComplex_DirectoryCategoryArray(array xmlParse) // _outputComplexDecodeMethod { assoc result, attr; array resultArray; int count; any elem, subElem, complexResult; for elem in xmlParse[0] do { // xsd:complexContent _outputConversionFromXML array=1 resultArray[count] = call "_decodeComplex_DirectoryCategory"(elem); count += 1; } return (resultArray); } GoogleSearchService:_decodeComplex_GoogleSearchResult(array xmlParse) // _outputComplexDecodeMethod { assoc result, attr; array resultArray; int count; any elem, subElem, complexResult; for elem in xmlParse[0] do { if (elem[1] == "documentFiltering") { if ((elem[2] == 0) || (elem[2] == "false")) result["documentFiltering"] = 0; else result["documentFiltering"] = 1; } if (elem[1] == "searchComments") { result["searchComments"] = elem[2]; } if (elem[1] == "estimatedTotalResultsCount") { result["estimatedTotalResultsCount"] = stringToNumber(elem[2], int); } if (elem[1] == "estimateIsExact") { if ((elem[2] == 0) || (elem[2] == "false")) result["estimateIsExact"] = 0; else result["estimateIsExact"] = 1; } if (elem[1] == "resultElements") { result["resultElements"] = call "_decodeComplex_ResultElementArray"(elem); } if (elem[1] == "searchQuery") { result["searchQuery"] = elem[2]; } if (elem[1] == "startIndex") { result["startIndex"] = stringToNumber(elem[2], int); } if (elem[1] == "endIndex") { result["endIndex"] = stringToNumber(elem[2], int); } if (elem[1] == "searchTips") { result["searchTips"] = elem[2]; } if (elem[1] == "directoryCategories") { result["directoryCategories"] = call "_decodeComplex_DirectoryCategoryArray"(elem); } if (elem[1] == "searchTime") { result["searchTime"] = stringToNumber(elem[2], double); } } return (result); } GoogleSearchService:_decodeComplex_DirectoryCategory(array xmlParse) // _outputComplexDecodeMethod { assoc result, attr; array resultArray; int count; any elem, subElem, complexResult; for elem in xmlParse[0] do { if (elem[1] == "fullViewableName") { result["fullViewableName"] = elem[2]; } if (elem[1] == "specialEncoding") { result["specialEncoding"] = elem[2]; } } return (result); } GoogleSearchService:_decodeComplex_ResultElement(array xmlParse) // _outputComplexDecodeMethod { assoc result, attr; array resultArray; int count; any elem, subElem, complexResult; for elem in xmlParse[0] do { if (elem[1] == "summary") { result["summary"] = elem[2]; } if (elem[1] == "URL") { result["URL"] = elem[2]; } if (elem[1] == "snippet") { result["snippet"] = elem[2]; } if (elem[1] == "title") { result["title"] = elem[2]; } if (elem[1] == "cachedSize") { result["cachedSize"] = elem[2]; } if (elem[1] == "relatedInformationPresent") { if ((elem[2] == 0) || (elem[2] == "false")) result["relatedInformationPresent"] = 0; else result["relatedInformationPresent"] = 1; } if (elem[1] == "hostName") { result["hostName"] = elem[2]; } if (elem[1] == "directoryCategory") { result["directoryCategory"] = call "_decodeComplex_DirectoryCategory"(elem); } if (elem[1] == "directoryTitle") { result["directoryTitle"] = elem[2]; } } return (result); } // END OF GENERATED CODE