python - TypeNotFoundError after import namespace -



python - TypeNotFoundError after import namespace -

my application in python(2.7) should utilize client consume soap web service described on wsdl(generated magento(1.7.0) , posted @ end).

for task suds(4.0) chosen, when tried connect these code:

from suds.client import client client = client(url)

i received typenotfound error due known problem described here https://fedorahosted.org/suds/wiki/documentation#fixingbrokenschemas

then changed code to:

from suds.client import client suds.xsd.doctor import import, importdoctor #fixing import imp = import('http://schemas.xmlsoap.org/soap/encoding/') imp.filter.add('urn:magento') client = client(self.url, plugins=[importdoctor(imp)] ) #now authentication session = client.service.login(username, password) #call method client.service.call(session,'catalog_product.info',['123'])

however, arose new exception:

file "/home/david.gonzalez/.virtualenvs/testlib/lib/python2.7/site- packages/suds/mx/literal.py", line 86, in start raise typenotfound(content.tag) suds.typenotfound: type not found: 'args'

i don't understand, why cannot find type of 'args' if explicit in wsdl:

<?xml version="1.0" encoding="utf-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:typens="urn:magento" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/xmlschema" name="magento" targetnamespace="urn:magento"> <types> <schema xmlns="http://www.w3.org/2001/xmlschema" targetnamespace="urn:magento"> <!-- <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemalocation="http://schemas.xmlsoap.org/soap/encoding/" /> --> <complextype name="fixedarray"> <complexcontent> <restriction base="soapenc:array"> <attribute ref="soapenc:arraytype" wsdl:arraytype="xsd:anytype[]" /> </restriction> </complexcontent> </complextype> </schema> </types> <message name="call"> <part name="sessionid" type="xsd:string" /> <part name="resourcepath" type="xsd:string" /> <part name="args" type="xsd:anytype" /> </message> <message name="callresponse"> <part name="callreturn" type="xsd:anytype" /> </message> <message name="multicall"> <part name="sessionid" type="xsd:string" /> <part name="calls" type="typens:fixedarray" /> <part name="options" type="xsd:anytype" /> </message> <message name="multicallresponse"> <part name="multicallreturn" type="typens:fixedarray" /> </message> <message name="endsession"> <part name="sessionid" type="xsd:string" /> </message> <message name="endsessionresponse"> <part name="endsessionreturn" type="xsd:boolean" /> </message> <message name="login"> <part name="username" type="xsd:string" /> <part name="apikey" type="xsd:string" /> </message> <message name="loginresponse"> <part name="loginreturn" type="xsd:string" /> </message> <message name="resources"> <part name="sessionid" type="xsd:string" /> </message> <message name="resourcesresponse"> <part name="resourcesreturn" type="typens:fixedarray" /> </message> <message name="globalfaults"> <part name="sessionid" type="xsd:string" /> </message> <message name="globalfaultsresponse"> <part name="globalfaultsreturn" type="typens:fixedarray" /> </message> <message name="resourcefaults"> <part name="resourcename" type="xsd:string" /> <part name="sessionid" type="xsd:string" /> </message> <message name="resourcefaultsresponse"> <part name="resourcefaultsreturn" type="typens:fixedarray" /> </message> <message name="startsession" /> <message name="startsessionresponse"> <part name="startsessionreturn" type="xsd:string" /> </message> <porttype name="mage_api_model_server_handlerporttype"> <operation name="call"> <documentation>call api functionality</documentation> <input message="typens:call" /> <output message="typens:callresponse" /> </operation> <operation name="multicall"> <documentation>multiple calls of resource functionality</documentation> <input message="typens:multicall" /> <output message="typens:multicallresponse" /> </operation> <operation name="endsession"> <documentation>end web service session</documentation> <input message="typens:endsession" /> <output message="typens:endsessionresponse" /> </operation> <operation name="login"> <documentation>login user , retrive session id</documentation> <input message="typens:login" /> <output message="typens:loginresponse" /> </operation> <operation name="startsession"> <documentation>start web service session</documentation> <input message="typens:startsession" /> <output message="typens:startsessionresponse" /> </operation> <operation name="resources"> <documentation>list of available resources</documentation> <input message="typens:resources" /> <output message="typens:resourcesresponse" /> </operation> <operation name="globalfaults"> <documentation>list of resource faults</documentation> <input message="typens:globalfaults" /> <output message="typens:globalfaultsresponse" /> </operation> <operation name="resourcefaults"> <documentation>list of global faults</documentation> <input message="typens:resourcefaults" /> <output message="typens:resourcefaultsresponse" /> </operation> </porttype> <binding name="mage_api_model_server_handlerbinding" type="typens:mage_api_model_server_handlerporttype"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="call"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="multicall"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="endsession"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="login"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="startsession"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="resources"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="globalfaults"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> <operation name="resourcefaults"> <soap:operation soapaction="urn:mage_api_model_server_handleraction" /> <input> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body namespace="urn:magento" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> </binding> <service name="magentoservice"> <port name="mage_api_model_server_handlerport" binding="typens:mage_api_model_server_handlerbinding"> <soap:address location="http://127.0.0.1/magento/index.php/api/soap/index/" /> </port> </service> </definitions>

my feeling error name of namespace, , have tried thread same results: soap suds , dreaded schema type not found error

this call:

client.service.call(session,'catalog_product.info',['123']) # <--- ['123']

maybe needs xsd:anytype[] work; i.o.w. array of anytype rather anytype.

<message name="call"> <part name="sessionid" type="xsd:string" /> <part name="resourcepath" type="xsd:string" /> <part name="args" type="xsd:anytype[]" /> </message>

python magento soap suds

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -