Home python Example SOAP query on Python?

Example SOAP query on Python?




There are SOAP requests for this type:

& lt; xml version = "1.0"? & gt;
& lt; SOAP-ENV: Envelope XMLNS: SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/"
XMLNS: XSD = "http://www.w3.org/2001/xmlschema" XMLNS: XSI = "http://www.w3.org/2001/xmlschema-instance"
XMLNS: SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/" & gt;
 & lt; SOAP-ENV: BODY SOAP-ENV: encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/" & gt;
  & lt; NS1: GetVersion XMLNS: NS1 = "URN: DCCINTF-IDCC" & gt;
   & lt; User & gt; & lt; / user & gt; - Username
   & lt; pass & gt; & lt; / pass & gt; - Password of the user
  & lt; / ns1: getversion & gt;
 & lt; / SOAP-ENV: Body & GT;
& lt; / SOAP-ENV: Envelope & GT;

which is somehow necessary to send to the address of the type:
http: // ip: port / wsdl

Share an example How can I implement such a request via Python?

or reference to any materials on this issue?

Answer 1, Authority 100%

Damn, it turned out all the same 🙂
So I thought, the snag was that the server administrator gave me a wrong address to send a query: (As a result, at the address of the server with the prefix / WSDL, received a list of supported methods, including the address for a request was also specified there.

And here is the program for the request:

import requests
ENDPOINT = "Here is the address for the request"
BODY = "" "here is a query" ""
Body = Body.encode ('UTF-8')
Session = Requests.session ()
session.headers = {"Content-Type": "text / xml; charset = utf-8"}
session.headers.update ({"Content-Length": STR (Len (Body))})
response = session.post (url = endpoint, data = body, verify = false)
Print (response.content)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions