python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

zeep.exceptions.XMLParseError: No namespace defined for 'tns' ('tns:ArrayOfKeyValueData')

Open sinahamedheidari opened this issue 8 years ago • 2 comments

I want to read data from WSDL with zeep in Python. Here's my simple code:

from zeep import Client
client=Client('http://api.netim.com/2.0/api.wsdl')
r = client.service.sessionOpen("username","password",'EN')
x=client.service.domainTldInfo(r,"COM")
print (x)

I get the following error:

"No namespace defined for %r (%r)" % (prefix, value))
zeep.exceptions.XMLParseError: No namespace defined for 'tns' ('tns:ArrayOfKeyValueData')

I thought it is a bug in the WSDL file. But if I check the same operations with php it works perfectly!

<?php
$clientSOAP = new SoapClient("http://api.netim.com/2.0/api.wsdl");

try
{
      $idSession = $clientSOAP->sessionOpen("username", "password", "EN");
      $StructDomainTldInfo = $clientSOAP->domainTldInfo($idSession, "COM");
      echo "<pre>";
      print_r($StructDomainTldInfo);
      echo "</pre>";
}
catch(SoapFault $fault)
{
      echo "Exception : " .$fault->getMessage(). "\n";
}

if(isset($idSession))
{
      $clientSOAP->sessionClose($idSession);
}
?>

Any help is appreciated.

sinahamedheidari avatar Oct 12 '18 06:10 sinahamedheidari

I get the same error here... I found out that if the WSDL metadata is hidden then I get that error. Have you got any response/solution to fix this?

leilakarimi avatar Dec 02 '18 21:12 leilakarimi

The tns prefix is not defined in the wsdl. You should report a bug with them :-)

mvantellingen avatar Dec 07 '18 21:12 mvantellingen