Python中的WSDL,带有和url+身份验证+端点



我是WSDL的新手,我想在Python中使用一个带有URL+端点的WSDL。

信息:

网址:https://sigaf.hacienda.go.cr/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zfmg_reports/500/zfmg_reports/binding?sap-客户端=500

用户名:Ws_cgr

密码:Claves+2021

和终点:https://sigaf.hacienda.go.cr/sap/bc/srt/rfc/sap/zfmg_reports/500/zfmg_reports/binding

我试过泡沫和zeep。

# suds
from suds.client import Client
url = "https://sigaf.hacienda.go.cr/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zfmg_reports/500/zfmg_reports/binding?sap-client=500"
mhws = Client(url, username='Ws_cgr', password='Claves+2021')

print(mhws)

和zeep

import requests
from requests.auth import HTTPBasicAuth 
from requests import Session
from zeep import Client
from zeep.transports import Transport
url = "https://sigaf.hacienda.go.cr/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zfmg_reports/500/zfmg_reports/binding?sap-client=500"
username = 'Ws_cgr' 
password = 'Claves+2021'

r = requests.get(url, auth=(username, password))
print(r.status_code)
session = Session()
session.auth = HTTPBasicAuth(username, password)
client = Client(url,
transport=Transport(session=session))

WSDL中包含信息的三个方法是ZwsYMhd7600042、ZwsZfmMenual和ZwsZinforme37Newm,我需要使用这些方法中的信息。

在这两种情况下,我都可以访问WSDL,但不能使用它。我真的不知道如何将端点信息放在python代码中以使用WSDL。

我使用了代理等选项,但没有任何明确和具体的内容。

你能在这个问题上帮我吗?

提前感谢!

试试这个:

from zeep import Client
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep.transports import Transport

wsdl = "https://sigaf.hacienda.go.cr/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zfmg_reports/500/zfmg_reports/binding?sap-client=500?wsdl"
username = 'Ws_cgr' 
password = 'Claves+2021'

session = Session()
session.auth = HTTPBasicAuth(username, password)
client = Client(wsdl, transport=Transport(session=session))

r = client.service.methodYouWant()

相关内容

  • 没有找到相关文章

最新更新