Hi, I am working on a process which I am trying to POST requests (WSDL link) and Get RESPONSE and parse the <Number value to XML. So, I started with Request and get response in python 3.8.
Please find below for Code using, Error facing, sample requests and response.
I tried search online to find help to fix this issue on other posts related to exception gaierror: [Errno 11001] getaddrinfo failed, Not found help.. Any help to resolve this issue will he most helpful. Thanks!
Sample Request :
please find code below for Skip SSL.
Code (SKIP SSL Verification)
Please find below for Code using, Error facing, sample requests and response.
I tried search online to find help to fix this issue on other posts related to exception gaierror: [Errno 11001] getaddrinfo failed, Not found help.. Any help to resolve this issue will he most helpful. Thanks!
from requests import Session from requests.auth import HTTPBasicAuth from zeep import Client session = Session() session.auth = HTTPBasicAuth('user', 'password') client = Client(wsdl = 'https:///sst/number.generator. num_2?WSDL') print(client.service.getNextNumber())
Error:runfile('C:/Users//Desktop/Project_Document/XML/SoupTest.py', wdir='C:/Users//Desktop/Project_Document/XML')
Traceback (most recent call last):
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
conn = connection.create_connection(
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\Users\\Anaconda3\lib\socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 976, in _validate_conn
conn.connect()
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connection.py", line 308, in connect
conn = self._new_conn()
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
raise NewConnectionError(
NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000000007F5EA60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\\Anaconda3\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 724, in urlopen
retries = retries.increment(
File "C:\Users\\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
MaxRetryError: HTTPSConnectionPool(host='sstdev.td.afg', port=1024): Max retries exceeded with url: /sst/number.generator.policynum_2?WSDL (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000000007F5EA60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\\Desktop\Project_Document\XML\SoupTest.py", line 15, in <module>
client = Client(wsdl = 'https://sstdev.td.afg:1024/sst/number.generator.policynum_2?WSDL')
File "C:\Users\\Anaconda3\lib\site-packages\zeep\client.py", line 68, in __init__
self.wsdl = Document(wsdl, self.transport, settings=self.settings)
File "C:\Users\\Anaconda3\lib\site-packages\zeep\wsdl\wsdl.py", line 80, in __init__
document = self._get_xml_document(location)
File "C:\Users\\Anaconda3\lib\site-packages\zeep\wsdl\wsdl.py", line 142, in _get_xml_document
return load_external(
File "C:\Users\\Anaconda3\lib\site-packages\zeep\loader.py", line 78, in load_external
content = transport.load(url)
File "C:\Users\\Anaconda3\lib\site-packages\zeep\transports.py", line 110, in load
content = self._load_remote_data(url)
File "C:\Users\\Anaconda3\lib\site-packages\zeep\transports.py", line 126, in _load_remote_data
response = self.session.get(url, timeout=self.load_timeout)
File "C:\Users\\Anaconda3\lib\site-packages\requests\sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "C:\Users\\Anaconda3\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\relangovan\Anaconda3\lib\site-packages\requests\sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "C:\Users\\Anaconda3\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='sstdev.td.afg', port=1024): Max retries exceeded with url: /sst/number.generator.policynum_2?WSDL (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000000007F5EA60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
Sample Request : and Sample ResponseSample Request :
Output:<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fac="http://systinet.com/wsdl//services/number/facade/">
<soapenv:Header/>
<soapenv:Body>
<fac:getNextNumber>
<BusinessUnit>geroet</BusinessUnit>
<PolicyType>Alphanumeric</PolicyType>
<SourceSystemCode>abcdef</SourceSystemCode>
</fac:getNextNumber>
</soapenv:Body>
</soapenv:Envelope>
Sample Response :Output:<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getNextNumberResponse xmlns:ns2="http://systinet.com/wsdl//services/number/facade/">
<return>
<status>true
</status>
<Number>AR70218
</Number>
</return>
</ns2:getNextNumberResponse>
</S:Body>
</S:Envelope>
I also tried with skip the SSL Certification validation, Still not works and has an error "TypeError: __init__() got an unexpected keyword argument 'strict'"please find code below for Skip SSL.
Code (SKIP SSL Verification)
from requests import Session from requests.auth import HTTPBasicAuth from zeep import Client from zeep.transports import Transport session = Session() session.verify = False transport = Transport(session=session) session.auth = HTTPBasicAuth('user', 'password') client = Client(wsdl = 'https:///sst/number.generator.policynum_2?WSDL' , transport=transport , strict=False) print(client.service.getNextPolicyNumber())
Error:runfile('C:/Users//Desktop/Project_Document/XML/SoapSkipSSL.py', wdir='C:/Users//Desktop/Project_Document/XML')
Traceback (most recent call last):
File "C:\Users\\Desktop\Project_Document\XML\SoapSkipSSL.py", line 17, in <module>
client = Client(wsdl = 'https:///sst/number.generator.policynum_2?WSDL' , transport=transport , strict=False)
TypeError: __init__() got an unexpected keyword argument 'strict'