samedi 25 juin 2016

Suds Jurko - Python - TypeNotFound: Type not found: 'Description'


Disclaimer: The SOAP client I am hitting is private so I am not able to divulge what the URL is. I understand this makes it difficult to help me troubleshoot, so please let me know what information is otherwise needed. Issue: Getting a TypeNotFound: Type not found: 'Description' error when executing a SOAP request. I think suds is throwing an error when parsing the response object. What I have tried: I have reached out to the owners of the endpoint but am not sure if it's their issue or not. I am going to submit an issue to the suds jurko repo once I am sure it is not something I am doing. Otherwise, I have looked into the suds doctor but have not been able to get that to work. Request Object from the WSDL: <s:element name="GetData"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="user" type="tns:User"/> <s:element minOccurs="0" maxOccurs="1" name="request" type="tns:GetDataRequest"/> </s:sequence> </s:complexType> </s:element> Response Object from the WSDL: <s:complexType name="GetDataResponse"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string"/> <s:element minOccurs="1" maxOccurs="1" name="ResponseCode" type="tns:SpecialResponseCode"/> ... </s:sequence> </s:complexType> Code: from suds.client import Client client = Client("https://url.foo.com/bar.asmx?WSDL") user = client.factory.create('User') user.LoginId = "String" user.Username = "String" user.Password = "String" request = client.factory.create('GetRequest') request.AccountNumber = "String of Numbers" response = client.service.GetData(user, request) Stack Trace: ../python2.7/site-packages/suds/client.pyc in __call__(self, *args, **kwargs) 519 client = clientclass(self.client, self.method) 520 try: --> 521 return client.invoke(args, kwargs) 522 except WebFault, e: 523 if self.faults(): ../python2.7/site-packages/suds/client.pyc in invoke(self, args, kwargs) 579 timer) 580 timer.start() --> 581 result = self.send(soapenv) 582 timer.stop() 583 metrics.log.debug("method '%s' invoked: %s", self.method.name, timer) ../python2.7/site-packages/suds/client.pyc in send(self, soapenv) 619 description=tostr(e), original_soapenv=original_soapenv) 620 return self.process_reply(reply=reply.message, --> 621 original_soapenv=original_soapenv) 622 623 def process_reply(self, reply, status=None, description=None, ../python2.7/site-packages/suds/client.pyc in process_reply(self, reply, status, description, original_soapenv) 683 684 result = replyroot and self.method.binding.output.get_reply( --> 685 self.method, replyroot) 686 ctx = plugins.message.unmarshalled(reply=result) 687 result = ctx.reply ../python2.7/site-packages/suds/bindings/binding.pyc in get_reply(self, method, replyroot) 145 if len(nodes): 146 resolved = rtypes[0].resolve(nobuiltin=True) --> 147 return self.unmarshaller().process(nodes[0], resolved) 148 149 def replylist(self, rt, nodes): ../python2.7/site-packages/suds/umx/typed.pyc in process(self, node, type) 64 content = Content(node) 65 content.type = type ---> 66 return Core.process(self, content) 67 68 def reset(self): ../python2.7/site-packages/suds/umx/core.pyc in process(self, content) 44 """ 45 self.reset() ---> 46 return self.append(content) 47 48 def append(self, content): ../python2.7/site-packages/suds/umx/core.pyc in append(self, content) 59 self.start(content) 60 self.append_attributes(content) ---> 61 self.append_children(content) 62 self.append_text(content) 63 self.end(content) ../python2.7/site-packages/suds/umx/core.pyc in append_children(self, content) 136 for child in content.node: 137 cont = Content(child) --> 138 cval = self.append(cont) 139 key = reserved.get(child.name, child.name) 140 if key in content.data: ../python2.7/site-packages/suds/umx/core.pyc in append(self, content) 57 @see: L{process()} 58 """ ---> 59 self.start(content) 60 self.append_attributes(content) 61 self.append_children(content) ../python2.7/site-packages/suds/umx/typed.pyc in start(self, content) 78 if found is None: 79 log.error(self.resolver.schema) ---> 80 raise TypeNotFound(content.node.qname()) 81 content.type = found 82 else: TypeNotFound: Type not found: 'Description'

Aucun commentaire:

Enregistrer un commentaire