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

  • Home
  • SEARCH
  • 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 715057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:08:39+00:00 2026-05-14T05:08:39+00:00

I have a camera on my network which I am trying to connect to

  • 0

I have a camera on my network which I am trying to connect to with suds but suds doesn’t send all the information needed. I need to put extra soap headers not defined in the WSDL file so the camera can understand the message. All the headers are contained in a SOAP envelope and then the suds command should be in the body of the message.

I have checked the suds website
and it says to pass in the headers like so: (This passes in the element as a header but I have an envelope so I’m not sure how to input this)

from suds.sax.element import Element
client = client(url)
ssnns = ('ssn', 'http://namespaces/sessionid')
ssn = Element('SessionID', ns=ssnns).setText('123')
client.set_options(soapheaders=ssn) 
result = client.service.addPerson(person)

Now, I am not sure how I would implement this. Say for example, I have the below header:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP
ENC="http://www.w3.org/2003/05/soap-encoding"
<wsa:MessageID SOAP-ENV:mustUnderstand="true">urn:uuid:43268c01-f09c6</wsa:MessageID>
 <SOAP-ENV:Header>

Using this or a similar example does anyone know how I would pass a valid SOAP message to the targeted service?

Thanks

  • 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-14T05:08:40+00:00Added an answer on May 14, 2026 at 5:08 am

    I have worked out how to enter in new headers and namespaces in suds.
    As stated above you create an Element and pass it in as a soapheader as so:

    from suds.sax.element import Element 
    client = client(url) 
    ssnns = ('ssn', 'http://namespaces/sessionid') 
    ssn = Element('SessionID', ns=ssnns).setText('123') 
    client.set_options(soapheaders=ssn)  
    result = client.service.addPerson(person)
    

    But if you would like to add a namespace I have found adding a prefix seem’s to do the trick. So when you create one of the elements you add addPrefix. I’m not sure if this was the way it was intended to be done but it work’s.

    ssn = Element('SessionID', ns=ssnns).setText('123').addPrefix(p='SOAP-ENC', u='http://www.w3.org/2003/05/soap-encoding')
    

    The p = 'SOAP-ENC' can be any prefix eg. wsa and the u = http://address is the address of the namespace.

    A complete script that would run could be:

    #!/usr/local/bin/python2.6
    
    import suds
    #import logging
    from suds.client import Client
    from suds.sax.element import Element
    from suds.sax.attribute import Attribute
    from suds.xsd.sxbasic import Import
    
    def absoluteMove():
    
        # connects to WSDL file and stores location in variable 'client'
        client = Client('http://10.10.10.10/p.wsdl')
        client.options.location = 'http://10.10.10.10:32963'
    
        # Create the header
        wsans = ('wsa', 'http://schemas.xmlsoap.org/ws/2004/08/addressing')
        mustAttribute = Attribute('SOAP-ENV:mustUnderstand', 'true')
        n1s = ('SOAP-ENC', 'http://www.w3.org/2003/05/soap-encoding')
        msgId = Element('Element').addPrefix(p='SOAP-ENC', u='http://www.w3.org/2003/05/soap-encoding')
    
        msgId2 = Element('Address', ns=wsans).setText('http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous')
        msgId1 = Element('ReplyTo', ns=wsans).insert(msgId2)
        msgId1.append(mustAttribute)
    
        msgId3 = Element('To', ns=wsans).setText('http://10.10.10.10:32954')
        msgId3.append(mustAttribute)
    
        client.set_options(soapheaders=[msgId, msgId1, msgId3, msgId2])
    
        # Create 'token' object to pass as an argument using the 'factory' namespace
        token = client.factory.create('ns4:ReferenceToken')
    
        # Create 'dest' object to pass as an argument and values passed to this object
        dest = client.factory.create('ns4:PTZVector')
        dest.PanTilt._x=1
        dest.PanTilt._y=4.9
        dest.Zoom._x=1
    
    
        # Create 'speed' object to pass as an argument and values passed to this object
        speed = client.factory.create('ns4:PTZSpeed')
        speed.PanTilt._x=0
        speed.PanTilt._y=0
        speed.Zoom._x=1
    
        # 'AbsoluteMove' method invoked passing in the new values entered in the above objects
    
        try:
            result = client.service.AbsoluteMove(token, dest, speed)
            print "absoluteMove result ", result
            return result
        except suds.WebFault, e:
            print "suds.WebFaults caught: "
            print e
    
    if __name__ == '__main__': result = absoluteMove()
    

    This moves the camera. To change the type of soap-envelope check my next question.

    You can add logging into this script whci allow’s you to check what xml command you have sent which is handy:

    import logging
    logging.basicConfig(level=logging.INFO)
    logging.getLogger('suds.client').setLevel(logging.DEBUG)
    

    The location can be put into the script as an option if the location is not in the wsdl file.

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

Sidebar

Related Questions

I have a camera and I am trying to connect to it vis suds.
Task: I have a camera mounted on the end of our assembly line, which
I have an IP camera which can give me media-data by RTSP. I develop
i am making a app which takes photo on button click i have camera.java
I am trying to read the streaming from a Network IP Camera. I can
I am trying to interface an ancient network camera to my computer and I
We have a network camera. It has an HTTP server to provides the current
I have camera preview on my android app but when I add an 'id'
I am looking for information on camera RS232/RS485 protocols. The camera I have lists
I have this camera application that I'm working on which uses openCV for image

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.