<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Calendar_SOAP_Server_Example</id>
	<title>Calendar SOAP Server Example - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Calendar_SOAP_Server_Example"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Calendar_SOAP_Server_Example&amp;action=history"/>
	<updated>2026-05-18T18:30:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Calendar_SOAP_Server_Example&amp;diff=2038&amp;oldid=prev</id>
		<title>PeterHarding: New page: &lt;pre&gt; #!/usr/bin/env python # #  $Id:$ # #---------------------------------------------------------------------  import sys, httplib  #-----------------------------------------------------...</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Calendar_SOAP_Server_Example&amp;diff=2038&amp;oldid=prev"/>
		<updated>2008-05-01T11:13:40Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;lt;pre&amp;gt; #!/usr/bin/env python # #  $Id:$ # #---------------------------------------------------------------------  import sys, httplib  #-----------------------------------------------------...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
#&lt;br /&gt;
#  $Id:$&lt;br /&gt;
#&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
import sys, httplib&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
SERVER_ADDR = &amp;quot;127.0.0.1&amp;quot;&lt;br /&gt;
SERVER_PORT = 8888&lt;br /&gt;
&lt;br /&gt;
CAL_NS = &amp;quot;http://uche.ogbuji.net/ws/eg/simple-cal&amp;quot;&lt;br /&gt;
&lt;br /&gt;
BODY_TEMPLATE = &amp;quot;&amp;quot;&amp;quot;&amp;lt;SOAP-ENV:Envelope&lt;br /&gt;
  xmlns:SOAP-ENV=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&lt;br /&gt;
  xmlns:s=&amp;quot;http://uche.ogbuji.net/eg/ws/simple-cal&amp;quot;&lt;br /&gt;
  xmlns:xsi=&amp;quot;http://www.w3.org/1999/XMLSchema-instance&amp;quot;&lt;br /&gt;
  xmlns:xsd=&amp;quot;http://www.w3.org/1999/XMLSchema&amp;quot;&lt;br /&gt;
  SOAP-ENV:encodingStyle=&amp;quot;http://schemas.xmlsoap.org/soap/encoding/&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;SOAP-ENV:Body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;s:getMonth&amp;gt;&lt;br /&gt;
      &amp;lt;year xsi:type=&amp;quot;xsd:integer&amp;quot;&amp;gt;%s&amp;lt;/year&amp;gt;&lt;br /&gt;
      &amp;lt;month xsi:type=&amp;quot;xsd:integer&amp;quot;&amp;gt;%s&amp;lt;/month&amp;gt;&lt;br /&gt;
    &amp;lt;/s:getMonth&amp;gt;&lt;br /&gt;
  &amp;lt;/SOAP-ENV:Body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SOAP-ENV:Envelope&amp;gt;&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
def GetMonth():&lt;br /&gt;
    year = 2007&lt;br /&gt;
    month = 7&lt;br /&gt;
    body = BODY_TEMPLATE%(year, month)&lt;br /&gt;
    blen = len(body)&lt;br /&gt;
&lt;br /&gt;
    requestor = httplib.HTTP(SERVER_ADDR, SERVER_PORT)&lt;br /&gt;
&lt;br /&gt;
    requestor.putrequest(&amp;#039;POST&amp;#039;, &amp;#039;cal-server&amp;#039;)&lt;br /&gt;
    requestor.putheader(&amp;#039;Host&amp;#039;, SERVER_ADDR)&lt;br /&gt;
    requestor.putheader(&amp;#039;Content-Type&amp;#039;, &amp;#039;text/plain; charset=&amp;quot;utf-8&amp;quot;&amp;#039;)&lt;br /&gt;
    requestor.putheader(&amp;#039;Content-Length&amp;#039;, str(blen))&lt;br /&gt;
    requestor.putheader(&amp;#039;SOAPAction&amp;#039;, CAL_NS)&lt;br /&gt;
    requestor.endheaders()&lt;br /&gt;
    requestor.send(body)&lt;br /&gt;
&lt;br /&gt;
    (status_code, message, reply_headers) = requestor.getreply()&lt;br /&gt;
&lt;br /&gt;
    reply_body = requestor.getfile().read()&lt;br /&gt;
&lt;br /&gt;
    print &amp;quot;status code:&amp;quot;, status_code&lt;br /&gt;
    print &amp;quot;status message:&amp;quot;, message&lt;br /&gt;
    print &amp;quot;HTTP reply body:\n&amp;quot;, reply_body&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    GetMonth()&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
#&lt;br /&gt;
#  $Id:$&lt;br /&gt;
#&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
import sys, calendar&lt;br /&gt;
&lt;br /&gt;
#Import the SOAP.py machinery&lt;br /&gt;
#from WebServices import SOAP&lt;br /&gt;
&lt;br /&gt;
import SOAPpy&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
CAL_NS = &amp;quot;http://uche.ogbuji.net/eg/ws/simple-cal&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
class Calendar:&lt;br /&gt;
  def getMonth(self, year, month):&lt;br /&gt;
    return calendar.month(year, month)&lt;br /&gt;
&lt;br /&gt;
  def getYear(self, year):&lt;br /&gt;
    return calendar.calendar(year)&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
server = SOAPpy.SOAPServer((&amp;quot;localhost&amp;quot;, 8888))&lt;br /&gt;
cal    = Calendar()&lt;br /&gt;
&lt;br /&gt;
server.registerObject(cal, CAL_NS)&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Starting server...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
server.serve_forever()&lt;br /&gt;
&lt;br /&gt;
#---------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:SOAP]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>