"Login" SOAP using Zeep in python

37 Views Asked by At

I am really very inexperienced using Python, not even at a beginner level, but for work I need to develop a project.

I use the SOAPUI program to view the WSDL information of a SOAP service, as an example I show you the information of the GetVersion service.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:gxw="http://schemas.datacontract.org/2004/07/GXWCF2">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:GetVersion>
         <tem:L>
            <gxw:LogonType>?</gxw:LogonType>
            <gxw:Password>?</gxw:Password>
            <gxw:UserName>?</gxw:UserName>
         </tem:L>
         <tem:version>?</tem:version>
         <tem:nErrorCode>?</tem:nErrorCode>
         <tem:strErrorXML>?</tem:strErrorXML>
      </tem:GetVersion>
   </soapenv:Body>
</soapenv:Envelope>

So with the SOAPUI application I can change the ? for the values I need and when executing e xml I have the requested response on the right side (image attached).

SOAPUI

I use the following Zeep syntax and have used some variations, but I always get the same answer.

Python

I understand that I need to change the ? of LogonType, Password and UserName, but I don't know how to send the information to the block that is between tem:L and </tem:L>, with the rest of ? I have no problem that they are outside that block, but I think that by not entering the login properly it is not sending me the correct information.

I appreciate any support you can give me.

Greetings!!!

I try:

import zeep
wsdl = 'http://laptop-jguerra:8030/SecurityExpertSOAPService/service.svc?wsdl'
client = zeep.Client(wsdl=wsdl)
print(client.service.GetVersion((0, '2016', 'soap'), 0, 0, 0))

my expectation:

{
    'GetVersionResult': true,
    'version': 1.6.0.11,
    'nErrorCode': 0,
    'strErrorXML': 0'
}

Thank you.

0

There are 0 best solutions below