mahshid.r
mahshid.r

Reputation: 302

How to implement a wsdl with zeep in python?

I'm using zeep to implementation web services, one of WSDLs doesn't work in python but in c# it's ok.

This is the code I am using:

from zeep import Client
wsdl = 'https://sep.shaparak.ir/payments/initpayment.asmx?wsdl'
client = Client(wsdl)

and, my error is:

requests.exceptions.HTTPError: 500 Server Error: Internal Server
Error for url: https://sep.shaparak.ir/payments/initpayment.asmx?wsdl

in c# it works! do you have any idea to help me ?!

Upvotes: 2

Views: 3265

Answers (3)

Alex Hellier
Alex Hellier

Reputation: 485

I use zeep with magento, here is how I load the wsdl and get a session ID

from zeep import Client
soap = Client(http://my-wsdl)
session = soap.service.login(USER, PASSWORD)

replace http://my-wsdl, USER PASSWORD as applicable

Then, to action a call

list_of_attribute_sets = soap.service.catalogProductAttributeSetList(session)

I hope this helps.

Upvotes: 0

Alzahraa Elsallakh
Alzahraa Elsallakh

Reputation: 11

It seems that the problem is with your wsdl as you said, try to use another.
for ex: http://www.soapclient.com/xml/soapresponder.wsdl
and edit your code to be:

client = zeep.Client(wsdl)

Upvotes: 1

oblivion02
oblivion02

Reputation: 567

With the information you are providing, I am unable to help you solve the Internal Server Error. But, I can help you get more information about what's going on...

http://docs.python-zeep.org/en/master/transport.html#debugging

import logging.config

logging.config.dictConfig({
    'version': 1,
    'formatters': {
        'verbose': {
            'format': '%(name)s: %(message)s'
        }
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose',
        },
    },
    'loggers': {
        'zeep.transports': {
            'level': 'DEBUG',
            'propagate': True,
            'handlers': ['console'],
        },
    }
})

Upvotes: 2

Related Questions