Initial commit
This commit is contained in:
37
XMLTesting.py
Normal file
37
XMLTesting.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from lxml import etree
|
||||
|
||||
# envelope = etree.XML('<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">')
|
||||
body = etree.Element("soap12")
|
||||
GetReport = etree.SubElement(body, "GetReport")
|
||||
reportName = etree.SubElement(body, "Orders")
|
||||
|
||||
|
||||
print(body.tag)
|
||||
|
||||
|
||||
|
||||
|
||||
# <?xml version="1.0" encoding="utf-8"?>
|
||||
# <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||
# <soap12:Body>
|
||||
# <GetReport xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||
# <token>40fb3d62-abfd-4476-b99f-75035aa1c0da</token>
|
||||
# <reportName>Orders</reportName>
|
||||
# <columnNames>
|
||||
# <string>Order ID</string>
|
||||
# <string>Order Price</string>
|
||||
# </columnNames>
|
||||
# </GetReport>
|
||||
# </soap12:Body>
|
||||
# </soap12:Envelope>
|
||||
|
||||
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<soap:Body>
|
||||
<ObtainUserTicketResponse xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||
<ObtainUserTicketResult>866c9811-f51d-4910-adb7-6321ec7f19ea</ObtainUserTicketResult>
|
||||
</ObtainUserTicketResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
||||
67
main.py
Normal file
67
main.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import requests
|
||||
from lxml import etree
|
||||
|
||||
from io import StringIO, BytesIO
|
||||
|
||||
ticket = '40fb3d62-abfd-4476-b99f-75035aa1c0d'
|
||||
|
||||
test = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||
<soap12:Body>
|
||||
<GetReport xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||
<token>"""+ticket+"""</token>
|
||||
<reportName>Orders</reportName>
|
||||
<columnNames>
|
||||
<string>Order ID</string>
|
||||
<string>Order Price</string>
|
||||
</columnNames>
|
||||
</GetReport>
|
||||
</soap12:Body>
|
||||
</soap12:Envelope>"""
|
||||
send = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||
<soap12:Body>
|
||||
<GetReport xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||
<token>40fb3d62-abfd-4476-b99f-75035aa1c0da</token>
|
||||
<reportName>Orders</reportName>
|
||||
<columnNames>
|
||||
<string>Order ID</string>
|
||||
<string>Order Price</string>
|
||||
</columnNames>
|
||||
</GetReport>
|
||||
</soap12:Body>
|
||||
</soap12:Envelope>"""
|
||||
|
||||
ObtainTicket = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||
<soap12:Body>
|
||||
<ObtainUserTicket xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||
<username>ddembinski</username>
|
||||
<password>mond@y</password>
|
||||
<ident>string</ident>
|
||||
</ObtainUserTicket>
|
||||
</soap12:Body>
|
||||
</soap12:Envelope>"""
|
||||
|
||||
ReleaseTicket = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||
<soap12:Body>
|
||||
<ReleaseTicket xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||
<ticket>fca51a05-d821-454c-9e5f-9aa19c94cf6f</ticket>
|
||||
</ReleaseTicket>
|
||||
</soap12:Body>
|
||||
</soap12:Envelope>"""
|
||||
|
||||
headers = {'Host': 'soprema.gli.us.com', 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'}
|
||||
|
||||
namespaces = {
|
||||
'soap': 'http://www.w3.org/2003/05/soap-envelope',
|
||||
'a': 'http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111'
|
||||
}
|
||||
|
||||
|
||||
response = requests.post('http://soprema.gli.us.com/Store/storefrontapi.asmx', data=ObtainTicket, headers=headers).text
|
||||
|
||||
print(response)
|
||||
xml = bytes(bytearray(response, encoding='utf-8'))
|
||||
doc = etree.XML(xml)
|
||||
Reference in New Issue
Block a user