#!/usr/bin/env python import httplib import sys SM_TEMPLATE = open(sys.argv[1], 'r') SoapMessage = SM_TEMPLATE.read() CERTFILE = "mycertificate.cer" KEYFILE = "myprivatekey.key" #print KEYFILE #print CERTFILE #The variable below is your host name followed by a colon and then the port your service is on. HOSTNAME = "wijisgwtest.wisconsin.gov:17444" #USE THIS FOR HTTPS WITH CLIENT CERTIFICATES conn = httplib.HTTPSConnection( HOSTNAME, key_file = KEYFILE, cert_file = CERTFILE ) #USE THIS FOR HTTPS WITHOUT CLIENT CERTIFICATES #conn = httplib.HTTPSConnection( HOSTNAME) #USE THIS FOR SIMPLE HTTP TESTING #conn = httplib.HTTPConnection(HOSTNAME) #print SoapMessage #construct and send the header conn.putrequest('POST', '/WijisGatewayRemoteSearch/RemoteGatewaySearchService') conn.putheader("Content-type", "text/xml; charset=\"UTF-8\"") conn.putheader("Content-length", "%d" % len(SoapMessage)) #Sometimes you will have to comment out the soap action below... conn.putheader("SOAPAction", "http://www.wisconsin.gov/wijis/gateway/RemoteGatewaySearchService/RemoteSearch") conn.endheaders() conn.send(SoapMessage) response = conn.getresponse() print response.read()