Thread: Python And Soap

Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    sweeet.

    Any help would be appreciated.

    Joe
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    11
    Just noticed in the script you posted to the python list that you had Content Length misspelled. If thats not the problem, heres my best shot ;-)

    Ok, I thought I had saved some of the script that I had used, it looks like the only thing I have is an old test script, but IIRC, it should still work. Here's your script modified.

    Code:
    #!/usr/bin/env python
    import httplib
    # triple quotes make it a little easier to read
    # and also speed it up a wee bit, no concat
    soap = """<?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:Body>
    <checkPassword
            xmlns="EDIT:PUT YOUR NAMESPACE HERE">
            <employeeID>XXXXXX</employeeID>
            <password>XXXXXX</password>
            <accessCode>XXXXX</accessCode>
    </checkPassword>
    </soap:Body>
    </soap:Envelope>"""
    
    # assuming its on port 80
    conn = httplib.HTTPConnection('insidecoair5', 80)
    # so we can see our debug messages, and the
    # actual packet the script will be sending
    conn.set_debuglevel(3)
    #n = conn.send(data)
    conn.request('POST', 'EDIT: PUT YOUR PAGE ACTION HERE', soap,
            {'Content-Type':'text/xml; charset=utf-8"',
            'Content-Length':str(len(soap)),
            'Accept':'text/xml; charset=utf-8',
            'SOAPAction':'EDIT: REPLACE THIS WITH YOUR ACTION'})
    resp = conn.getresponse()
    data = resp.read()
    # our returned packet
    print data
    Lemme know if that helps any. If it doesn't work, post the entire debug output (or PM it to me if its sensitive in nature and you don't want it posted in the forums).

    EDIT: Removed some of the page stuff because it put quotes around it. Just replace the EDIT stuff with the logical thing that goes there ;-)
    Last edited by oxygenthief; January 9th, 2004 at 09:13 PM.
  4. #18
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    Sorry, i was away on a trip.

    Thanks oxygen for all your help. I got it to work using the get method.

    Joe
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo