Web services in PHP

I was recently asked if .NET webservices could be used from PHP, and the answer is they can.
Thanks to a toolkit called nusoap (http://sourceforge.net/projects/nusoap/)

I managed to get the Google Web search webservice working (client3.php)

Here’s the output:

Result

Array
(
[directoryCategories] => Array
(
)

[documentFiltering] =>
[endIndex] => 10
[estimateIsExact] =>
[estimatedTotalResultsCount] => 19300000
[resultElements] => Array
(
[0] => Array
(
[URL] => http://en.wikipedia.org/wiki/Robotics
[cachedSize] => 124k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Robotics is the science and technology of robots, and their design, manufacture,
and application. [1] Robotics has connections to electronics, mechanics, ...
[summary] =>
[title] => Robotics - Wikipedia, the free encyclopedia
)

[1] => Array
(
[URL] => http://www.thetech.org/exhibits/online/robotics/
[cachedSize] => 9k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => The history and workings of robotics. From the Tech Museum of Innovation.
[summary] =>
[title] => The Tech Museum: Robotics: Sensing, Thinking, Acting
)

[2] => Array
(
[URL] => http://www.thetech.org/robotics/
[cachedSize] => 9k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => The history and workings of robotics. From the Tech Museum of Innovation.
[summary] =>
[title] => The Tech Museum: Robotics: Sensing, Thinking, Acting
)

[3] => Array
(
[URL] => http://www.arrickrobotics.com/
[cachedSize] => 10k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Manufactures and sells mobile robots, stepper motor systems, XY positioning
tables and automation accessories. General technical information on robots.
[summary] =>
[title] => Arrick Robotics - Stepper motor, Positioning, Automation, Mobile ...
)

[4] => Array
(
[URL] => http://www.robotics.org/
[cachedSize] => 25k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Jan 27, 2009 ... Robotics Online - RIA - Robotic Industries Association ... Saint Joseph's
Launches International College of Robotic Surgery ...
[summary] =>
[title] => RIA - Robotics Online - Your #1 Online Resource for Industrial ...
)

[5] => Array
(
[URL] => http://msdn.microsoft.com/en-us/robotics/default.aspx
[cachedSize] => 37k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Microsoft Robotics Developer Studio Standard and Academic Editions have the ...
Collada Update (Jan 2009) for Microsoft Robotics Developer Studio 2008 ...
[summary] =>
[title] => Microsoft Robotics
)

[6] => Array
(
[URL] => http://www.ri.cmu.edu/
[cachedSize] => 33k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Established in 1979 to conduct basic and applied research in robotics
technologies relevant to industrial and societal tasks. Links to a range of
specific ...
[summary] =>
[title] => The Robotics Institute
)

[7] => Array
(
[URL] => http://robotics.nasa.gov/
[cachedSize] => 25k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => A NASA project dedicated to encouraging people to become involved in science and
engineering, particularly building robots. Visit this website to learn ...
[summary] =>
[title] => NASA Robotics - Robotics Alliance Project
)

[8] => Array
(
[URL] => http://robotics.jpl.nasa.gov/
[cachedSize] => 30k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => MOBILITY AND ROBOTIC SYSTEMS Richard Volpe, Manager Gabriel Udomkesmalee, Deputy
Manager.
[summary] =>
[title] => JPL Robotics: Home Page
)

[9] => Array
(
[URL] => http://www.roboticstrends.com/
[cachedSize] => 19k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => News, information, opinion and analysis portal covering the personal, service,
mobile and military robotics markets.
[summary] =>
[title] => Robotics Trends | Robots and Robotics Technology News, Information ...
)

)

[searchComments] =>
[searchQuery] => robotics
[searchTime] => 0.437665
[searchTips] =>
[startIndex] => 1
)

Request

POST /search/beta2 HTTP/1.0
Host: api.google.com
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "urn:GoogleSearch"
Content-Length: 960

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns6198:doGoogleSearch xmlns:ns6198="urn:GoogleSearch"><Googlekey xsi:type="xsd:string">s06KddJQFHI4ZF25z0a8q7P3bjSGzh74</Googlekey><queryStr xsi:type="xsd:string">robotics</queryStr><startFrom xsi:type="xsd:int">0</startFrom><maxResults xsi:type="xsd:int">10</maxResults><filter xsi:type="xsd:boolean">1</filter><restrict xsi:type="xsd:string"></restrict><adultContent xsi:type="xsd:boolean">1</adultContent><language xsi:type="xsd:string"></language><iencoding xsi:type="xsd:string"></iencoding><oendcoding xsi:type="xsd:string"></oendcoding></ns6198:doGoogleSearch></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response

HTTP/1.0 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 10504
Date: Wed, 28 Jan 2009 10:50:35 GMT
Expires: Wed, 28 Jan 2009 10:50:35 GMT
Cache-Control: private, max-age=0
Server: GFE/1.3
Connection: Close

<?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:doGoogleSearchResponse xmlns:ns1="urn:GoogleSearch" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="ns1:GoogleSearchResult">
<directoryCategories xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="ns1:DirectoryCategory[0]">
</directoryCategories>
<documentFiltering xsi:type="xsd:boolean">false</documentFiltering>
<endIndex xsi:type="xsd:int">10</endIndex>
<estimateIsExact xsi:type="xsd:boolean">false</estimateIsExact>
<estimatedTotalResultsCount xsi:type="xsd:int">19300000</estimatedTotalResultsCount>
<resultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://en.wikipedia.org/wiki/Robotics</URL>
<cachedSize xsi:type="xsd:string">124k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">&lt;b&gt;Robotics&lt;/b&gt; is the science and technology of &lt;b&gt;robots&lt;/b&gt;, and their design, manufacture, &lt;br&gt; and application. [1] &lt;b&gt;Robotics&lt;/b&gt; has connections to electronics, mechanics, &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">&lt;b&gt;Robotics&lt;/b&gt; - Wikipedia, the free encyclopedia</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.thetech.org/exhibits/online/robotics/</URL>
<cachedSize xsi:type="xsd:string">9k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">The history and workings of &lt;b&gt;robotics&lt;/b&gt;. From the Tech Museum of Innovation.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">The Tech Museum: &lt;b&gt;Robotics&lt;/b&gt;: Sensing, Thinking, Acting</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.thetech.org/robotics/</URL>
<cachedSize xsi:type="xsd:string">9k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">The history and workings of &lt;b&gt;robotics&lt;/b&gt;. From the Tech Museum of Innovation.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">The Tech Museum: &lt;b&gt;Robotics&lt;/b&gt;: Sensing, Thinking, Acting</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.arrickrobotics.com/</URL>
<cachedSize xsi:type="xsd:string">10k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Manufactures and sells mobile &lt;b&gt;robots&lt;/b&gt;, stepper motor systems, XY positioning &lt;br&gt; tables and automation accessories. General technical information on &lt;b&gt;robots&lt;/b&gt;.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">Arrick &lt;b&gt;Robotics&lt;/b&gt; - Stepper motor, Positioning, Automation, Mobile &lt;b&gt;...&lt;/b&gt;</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.robotics.org/</URL>
<cachedSize xsi:type="xsd:string">25k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Jan 27, 2009 &lt;b&gt;...&lt;/b&gt; &lt;b&gt;Robotics&lt;/b&gt; Online - RIA - &lt;b&gt;Robotic&lt;/b&gt; Industries Association &lt;b&gt;...&lt;/b&gt; Saint Joseph&amp;#39;s &lt;br&gt; Launches International College of &lt;b&gt;Robotic&lt;/b&gt; Surgery &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">RIA - &lt;b&gt;Robotics&lt;/b&gt; Online - Your #1 Online Resource for Industrial &lt;b&gt;...&lt;/b&gt;</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://msdn.microsoft.com/en-us/robotics/default.aspx</URL>
<cachedSize xsi:type="xsd:string">37k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Microsoft &lt;b&gt;Robotics&lt;/b&gt; Developer Studio Standard and Academic Editions have the &lt;b&gt;...&lt;/b&gt; &lt;br&gt; Collada Update (Jan 2009) for Microsoft &lt;b&gt;Robotics&lt;/b&gt; Developer Studio 2008 &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">Microsoft &lt;b&gt;Robotics&lt;/b&gt;</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.ri.cmu.edu/</URL>
<cachedSize xsi:type="xsd:string">33k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Established in 1979 to conduct basic and applied research in &lt;b&gt;robotics&lt;/b&gt; &lt;br&gt; technologies relevant to industrial and societal tasks. Links to a range of &lt;br&gt; specific &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">The &lt;b&gt;Robotics&lt;/b&gt; Institute</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://robotics.nasa.gov/</URL>
<cachedSize xsi:type="xsd:string">25k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">A NASA project dedicated to encouraging people to become involved in science and &lt;br&gt; engineering, particularly building &lt;b&gt;robots&lt;/b&gt;. Visit this website to learn &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">NASA &lt;b&gt;Robotics&lt;/b&gt; - &lt;b&gt;Robotics&lt;/b&gt; Alliance Project</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://robotics.jpl.nasa.gov/</URL>
<cachedSize xsi:type="xsd:string">30k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">MOBILITY AND &lt;b&gt;ROBOTIC&lt;/b&gt; SYSTEMS Richard Volpe, Manager Gabriel Udomkesmalee, Deputy &lt;br&gt; Manager.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">JPL &lt;b&gt;Robotics&lt;/b&gt;: Home Page</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.roboticstrends.com/</URL>
<cachedSize xsi:type="xsd:string">19k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">News, information, opinion and analysis portal covering the personal, service, &lt;br&gt; mobile and military &lt;b&gt;robotics&lt;/b&gt; markets.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">&lt;b&gt;Robotics&lt;/b&gt; Trends | &lt;b&gt;Robots&lt;/b&gt; and &lt;b&gt;Robotics&lt;/b&gt; Technology News, Information &lt;b&gt;...&lt;/b&gt;</title>
</item>
</resultElements>
<searchComments xsi:type="xsd:string"></searchComments>
<searchQuery xsi:type="xsd:string">robotics</searchQuery>
<searchTime xsi:type="xsd:double">0.437665</searchTime>
<searchTips xsi:type="xsd:string"></searchTips>
<startIndex xsi:type="xsd:int">1</startIndex>
</return>
</ns1:doGoogleSearchResponse>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Debug

2009-01-28 10:50:55.359379 nusoap_client: ctor wsdl= timeout=0 response_timeout=30
endpoint=string(34) "http://api.google.com/search/beta2"
2009-01-28 10:50:55.360128 nusoap_client: instantiate SOAP with endpoint at http://api.google.com/search/beta2
2009-01-28 10:50:55.361319 nusoap_client: setUseCURL(0)
2009-01-28 10:50:55.362546 nusoap_client: call: operation=doGoogleSearch, namespace=urn:GoogleSearch, soapAction=urn:GoogleSearch, rpcParams=, style=rpc, use=encoded, endpointType=soap
params=array(10) {
["Googlekey"]=>
string(32) "s06KddJQFHI4ZF25z0a8q7P3bjSGzh74"
["queryStr"]=>
string(8) "robotics"
["startFrom"]=>
int(0)
["maxResults"]=>
int(10)
["filter"]=>
bool(true)
["restrict"]=>
string(0) ""
["adultContent"]=>
bool(true)
["language"]=>
string(0) ""
["iencoding"]=>
string(0) ""
["oendcoding"]=>
string(0) ""
}
headers=bool(false)
2009-01-28 10:50:55.363275 nusoap_client: serializing param array for operation doGoogleSearch
2009-01-28 10:50:55.364631 nusoap_client: in serialize_val: name=Googlekey, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(32) "s06KddJQFHI4ZF25z0a8q7P3bjSGzh74"
attributes=bool(false)
2009-01-28 10:50:55.365308 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.367119 nusoap_client: serialize_val returning <Googlekey xsi:type="xsd:string">s06KddJQFHI4ZF25z0a8q7P3bjSGzh74</Googlekey>
2009-01-28 10:50:55.368314 nusoap_client: in serialize_val: name=queryStr, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(8) "robotics"
attributes=bool(false)
2009-01-28 10:50:55.368980 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.370159 nusoap_client: serialize_val returning <queryStr xsi:type="xsd:string">robotics</queryStr>
2009-01-28 10:50:55.370744 nusoap_client: in serialize_val: name=startFrom, type=, name_ns=, type_ns=, use=encoded, soapval=
value=int(0)
attributes=bool(false)
2009-01-28 10:50:55.371388 nusoap_client: serialize_val: serialize int
2009-01-28 10:50:55.371939 nusoap_client: serialize_val returning <startFrom xsi:type="xsd:int">0</startFrom>
2009-01-28 10:50:55.373122 nusoap_client: in serialize_val: name=maxResults, type=, name_ns=, type_ns=, use=encoded, soapval=
value=int(10)
attributes=bool(false)
2009-01-28 10:50:55.373807 nusoap_client: serialize_val: serialize int
2009-01-28 10:50:55.374378 nusoap_client: serialize_val returning <maxResults xsi:type="xsd:int">10</maxResults>
2009-01-28 10:50:55.374939 nusoap_client: in serialize_val: name=filter, type=, name_ns=, type_ns=, use=encoded, soapval=
value=bool(true)
attributes=bool(false)
2009-01-28 10:50:55.375600 nusoap_client: serialize_val: serialize boolean
2009-01-28 10:50:55.376151 nusoap_client: serialize_val returning <filter xsi:type="xsd:boolean">1</filter>
2009-01-28 10:50:55.376893 nusoap_client: in serialize_val: name=restrict, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(0) ""
attributes=bool(false)
2009-01-28 10:50:55.377546 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.378117 nusoap_client: serialize_val returning <restrict xsi:type="xsd:string"></restrict>
2009-01-28 10:50:55.378729 nusoap_client: in serialize_val: name=adultContent, type=, name_ns=, type_ns=, use=encoded, soapval=
value=bool(true)
attributes=bool(false)
2009-01-28 10:50:55.379415 nusoap_client: serialize_val: serialize boolean
2009-01-28 10:50:55.379966 nusoap_client: serialize_val returning <adultContent xsi:type="xsd:boolean">1</adultContent>
2009-01-28 10:50:55.380546 nusoap_client: in serialize_val: name=language, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(0) ""
attributes=bool(false)
2009-01-28 10:50:55.381213 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.381785 nusoap_client: serialize_val returning <language xsi:type="xsd:string"></language>
2009-01-28 10:50:55.382395 nusoap_client: in serialize_val: name=iencoding, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(0) ""

Categories: Uncategorized

IPhone application out to tender

Categories: Uncategorized

Using Gliffy to create entity models

Categories: Uncategorized

Com Reflection

I read with interest this month’s MSDN magazine article on COM reflection.
The article provides an example of using reflection to uncover hidden
properties and methods of the Speech library, and also explains how the
elusive System.__ComObject can give up its goodies, so to speak.

It
works fine on the sample Speech API DLL on the site, however, it isn’t
so hot when it comes to Sage. I tried plugging in some common CLSID’s
from Sage’s inner workings, but it gave up no further information. I
then tried passing a System.__ComObject to it, with the following code;

Dim oUnknown As Object = o.GetCompanies("C:Program FilesSageAccounts")
DumpCOMObject(oUnknown)

However, it crashed out when IDispatch::GetTypeInfoCount returned 0. According to MSDN reference this is done to prevent run-time inspection of the DLL, perhaps for security purposes.

So,
I guess this is a bit of an anti-pattern when it comes to Sage
development, but I hope that this research saves another developer some
time when it comes to trying to figure out the million dollar question
‘what do I cast this object to now?

Categories: Uncategorized

AppAnalyze launched on SourceForge

Over the years, you develop many different components for different projects that sometimes get reused in many different ways.

After a while when you start going down one path of maybe one or two larger projects, many of the components you developed once, no longer apply.
Therefore I decided to dig into my old toolkit and publish some of the components I once relied on for my bread-and-butter development work.

The first of which is AppAnalyze, which is now released under GPL open source on sourceforge
 http://sourceforge.net/projects/appanalyze/

I hope this provides as much benefit to you as it did for me.

Categories: Uncategorized

Firing an onchange event from a HTMLSelectElement

Something I just solved, which alot of people seemed to be stuggling with, is the ability to fire the onchange method of a select
box programatically from .NET (in this case VB.NET)
 
Basically the problem is, if you have a drop down list, stored in a HTMLSelectElement, and you set the selectedIndex propery, the onchange event doesn’t automatically get called. – the same happens in Javascript – but you can’t call onchange() like in Javascript, since it’s a property, not a method.
 
Solution
 
hse.FireEvent("onchange", hse.onchange)
 
where hse is the HTMLSelectelement
 
 
Categories: Uncategorized

Javascript redirect after images have loaded

This is a handy piece of javascript that can be used to execute a redirect only after all images have loaded on a page, up to a maximum of 10 seconds. I put in this maximum threshold, to account for the possibility of a bad link on the page, or a user with images turned off on their browser.

waitForImages();
var imageLoadTimeout = 10; // max 10 seconds;
var timeWaited = 0;
function waitForImages()

 var AllLoaded=true;
 if (timeWaited>imageLoadTimeout)
 {
  // redirect after 10 seconds, regardless of whether images are loaded.
  ImagesLoaded();
  return;
 } 
 for(i=0;i<document.images.length;i++)
 {
  var image = document.images[i];   
  if (!image.complete && image.name != "brokenImage" )
  {
  
   AllLoaded=false;
   break;
  }
 }  
 if (AllLoaded)
 {
  ImagesLoaded();
 }
 else
 {
  timeWaited += 0.5;
  setTimeout(‘waitForImages()’,500);
 }
}

function ImagesLoaded()
{
 RedirectPage();
}

Categories: Uncategorized

Useful c# function – remove duplicates

Categories: Uncategorized

del.icio.us auto-post

This is a bit of code I wrote that will automatically post a website to delicious.  The HttpRequest Class is outside of the scope of this post, but you should get the jist of how it’s done.
 

private void SubmitDelicious(string url,string description,string username,string password,string tags)

{

#region

postdata

/*

POST /login HTTP/1.1

Host: secure.del.icio.us

user_name=nora344

password=lokiju

jump=no

url=http%3A%2F%2Fwww.envoyez.com

login=log+in

GET /nora344?url=http%3A%2F%2Fwww.envoyez.com

jump=no

POST /nora344?636480 HTTP/1.1

Host: del.icio.us

url=http%3A%2F%2Fwww.envoyez.com

oldurl=http%3A%2F%2Fwww.envoyez.com

description=envoyez+sms

notes=

tags=

jump=no

key=6c7b3c42b196c8e3ebc90130317786eb

*/

#endregion

// step 1. login

string strUrl = "https://secure.del.icio.us/login&quot;;

string strPostdata = "user_name=" + username + "&";

strPostdata += "password=" + password + "&";

strPostdata += "jump=no&";

strPostdata += "url=" + HttpUtility.UrlEncode(url) + "&";

strPostdata += "login=log+in&";

HTTPRequest hrWeb =

new HTTPRequest();

hrWeb.blnExpect100Continue = false;

string html = hrWeb.Request(strUrl,"POST",strPostdata);

// at this point, we may need to transfer cookies from secure.delicious to delicious?

CookieCollection ckCol = hrWeb.RequestCookies.GetCookies(

new Uri("https://secure.del.icio.us&quot;));

 

Cookie ckAccept = new Cookie("_accept_s_cookies","1","/",".icio.us");

Cookie ckInstall =

new Cookie("_ext_install_redir","1","/",".icio.us");

Cookie ckRegister =

new Cookie("_register_id","1248967165","/",".icio.us"); // _register_id?

Cookie ckUser =

new Cookie("_user",ckCol["_user"].Value,"/",".icio.us");

Cookie ckBM = new Cookie("_bm_url",HttpUtility.UrlEncode(url),"/",".icio.us");

// BX=4ehl0pt2i6vse&b=3&s=dr – already set

hrWeb.RequestCookies.Add(ckAccept);

hrWeb.RequestCookies.Add(ckInstall);

hrWeb.RequestCookies.Add(ckRegister);

hrWeb.RequestCookies.Add(ckUser);

hrWeb.RequestCookies.Add(ckBM);

// step 2. redirect

strUrl = "http://del.icio.us/&quot;;

strUrl += username;

strUrl += "?url=" + HttpUtility.UrlEncode(url) + "&jump=no";

html = hrWeb.Request(strUrl);

if (html.IndexOf("in order to save an item, you have to log in")!=-1)

{

return;

}

string strIDRegex = @"action…w+?(?<ID>d+)";

string strID = Regex.Match(html,strIDRegex).Groups["ID"].Value;

string strKeyRegex = @"key..value..(?<KEY>w+)";

string strKey = Regex.Match(html,strKeyRegex).Groups["KEY"].Value;

// step 3. post

strUrl = "http://del.icio.us/&quot; + username + "?" + strID;

strPostdata = "url=" + HttpUtility.UrlEncode(url) + "&";

strPostdata += "oldurl=" + HttpUtility.UrlEncode(url) + "&";

strPostdata += "description=" + HttpUtility.UrlEncode(description) + "&";

strPostdata += "notes=&";

strPostdata += "tags=" + HttpUtility.UrlEncode(tags) + "&";

strPostdata += "jump=no&";

strPostdata += "key=" + strKey;

html = hrWeb.Request(strUrl,"POST",strPostdata);

}

 

Categories: Uncategorized

Java Midlet for .NET web services

Ever wonder how they make Java games for mobile phones, and ever wondered how to make something more useful on them than a Game. I was curious, and thought about writing an app that can use a webservice from a mobile phone (mine’s a Sanyo S750i). To dispell the myth that networking from phones is expensive. I checked my credit before and using this code, and it only cost me 2p. No Lie!.
 
To cut to the chase, you can download the source code from http://www.freebiesms.com/javasms.zip and the JAD file (for a mobile phone) at http://www.freebiesms.com/sms.jad
 
First off, you’ll need to download the Java Micro Edition (v5), get the bundle with the NetBeans IDE. You’ll also need to download the Netbeans mobility pack v5. This makes it easy to develop mobile applications (although the GUI designer is rubbish).
 
– ok cut short. need to go to work. Check out the code to see how I did it! 🙂
 
Categories: Uncategorized