Fatih Enes
Fatih Enes

Reputation: 95

"An error occurred when verifying security for the message." WSDL Zeep

i am trying to get information from a wsdl service but i am keep getting the same error over and over again. I am wondering what could be the reason behind this. Here is my code

from zeep import Client
import certifi
import os
import xlrd
import arcpy
from zeep import helpers
import pandas as pd
import logging
import warnings
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep.transports import Transport
import requests
from zeep.wsse.username import UsernameToken
from zeep.wsse.signature import Signature

wsdl = "https://kpsv2.saglik.gov.tr/?wsdl&service=kpsServices&isTest=true"


session = Session()
session.verify = certifi.where()

#session.auth = HTTPBasicAuth(nvi_id,nvi_pw)

client = Client(wsdl, transport=Transport(session=session))
client.service.YetkiListesi()

Which returns me the error as

Fault                                     Traceback (most recent call last)
In  [5]:
Line 1:     client.service.YetkiListesi()

File C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\mersinOrtami\lib\site-packages\zeep\proxy.py, in __call__:
Line 51:    kwargs,

File C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\mersinOrtami\lib\site-packages\zeep\wsdl\bindings\soap.py, in send:
Line 135:   return self.process_reply(client, operation_obj, response)

File C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\mersinOrtami\lib\site-packages\zeep\wsdl\bindings\soap.py, in process_reply:
Line 229:   return self.process_error(doc, operation)

File C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\mersinOrtami\lib\site-packages\zeep\wsdl\bindings\soap.py, in process_error:
Line 396:   subcodes=subcodes,

Fault: An error occurred when verifying security for the message.

Upvotes: 0

Views: 706

Answers (1)

AKX
AKX

Reputation: 168967

SOAP Faults are sent by the remote server. In your case, the remote server is telling you that

An error occurred when verifying security for the message.

so in other words, you're likely not passing (the correct) security information along with your request.

You will need to refer to the service provider's documentation to figure out what the security requirements are.

As an aside, your code simplifies to

from zeep import Client

client = Client("https://kpsv2.saglik.gov.tr/?wsdl&service=kpsServices&isTest=true")
client.service.YetkiListesi()

since the issue has nothing to do with your local security settings.

Upvotes: 1

Related Questions