Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4000304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:45:54+00:00 2026-05-20T07:45:54+00:00

Hello I am trying to do a SOAP request here is my code: #

  • 0

Hello I am trying to do a SOAP request here is my code:

# Create an OpenerDirector with support for Basic HTTP Authentication...
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(realm='webservices.autotask.net',
                          uri='https://webservices.autotask.net/atservices/1.5/atws.asmx',
                          user=username,
                          passwd=password)
opener = urllib2.build_opener(auth_handler)
# ...and install it globally so it can be used with urlopen.
urllib2.install_opener(opener)
page = urllib2.urlopen('https://webservices.autotask.net/atservices/1.5/atws.asmx')
print (page.read(100))


SM_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <AutotaskIntegrations xmlns="https://webservices.autotask.net/ATWS/v1_5/">
      <PartnerID>string</PartnerID>
    </AutotaskIntegrations>
  </soap:Header>
  <soap:Body>
    <getThresholdAndUsageInfo xmlns="https://webservices.autotask.net/ATWS/v1_5/">
      <sXML>string</sXML>
    </getThresholdAndUsageInfo>
  </soap:Body>
</soap:Envelope>

"""
SoapMessage = SM_TEMPLATE%()

print SoapMessage


# construct and send the header
webservice = httplib.HTTPSConnection("http://webservices.autotask.net", 443)
webservice.putrequest("POST", "/ATWS/v1_5/atws.asmx")
webservice.putheader("Host", "http://webservices.autotask.net")
webservice.putheader("User-Agent", "Python post")
webservice.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
webservice.putheader("Content-length", "%d" % len(SoapMessage))
webservice.putheader("SOAPAction", "\"\"")
print("HEADERS")
webservice.endheaders()
webservice.send(SoapMessage)

# get the response

statuscode, statusmessage, header = webservice.getreply()
print ("Response: ", statuscode, statusmessage)
print ("headers: ", header)
res = webservice.getfile().read()
print (res)

The error I am getting is(BTW line 69 is webservice.endheaders()):

Traceback (most recent call last):
File "<pyshell#89>", line 1, in <module>
l()
File "C:\Users\george\Documents\Autotask\Contract\AT Contract.py", line 69, in l
webservice.endheaders()
File "C:\Python27\lib\httplib.py", line 937, in endheaders
self._send_output(message_body)
File "C:\Python27\lib\httplib.py", line 797, in _send_output
self.send(msg)
File "C:\Python27\lib\httplib.py", line 759, in send
self.connect()
File "C:\Python27\lib\httplib.py", line 1140, in connect
self.timeout, self.source_address)
File "C:\Python27\lib\socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 11004] getaddrinfo failed

Any ideas?

Edit: I eventually found a .Net library on their forums. The library server me for what I needed to do.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:45:55+00:00Added an answer on May 20, 2026 at 7:45 am

    HTTPSConnection takes a host name, not a URL, so it should be

    webservice = httplib.HTTPSConnection("webservices.autotask.net", 443)
    

    and i believe that the host header is added for you, so you can skip that, but if its not, that should also be the host name, and not a URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To be specific, I was trying this code: package hello; public class Hello {
I'm trying to consume a hello world AXIS2 SOAP web service using a PHP
Hello I'm trying to use protected http socks server with socket module as in
Hello I´m trying using the next piece of code: import pickle object = Object()
I'm trying something like this Output.py print Hello Input.py greeting = raw_input(Give me the
So I'm trying to run my first hello world prog written in C. I
py2exe does not work with the standard email module Hello. I am trying to
I'm trying to make a little Hello World webservice with Django following a few
I'm trying to consume a .Net Web Service using perl and SOAP Lite. When
I'm trying to teach myself SOAP, just to extend my skillset a bit, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.