def callInfoFromWSDL(port, name):
wsdl = port.getService().getWSDL()<EOL>binding = port.getBinding()<EOL>portType = binding.getPortType()<EOL>operation = portType.operations[name]<EOL>opbinding = binding.operations[name]<EOL>messages = wsdl.messages<EOL>callinfo = SOAPCallInfo(name)<EOL>addrbinding = port.getAddressBinding()<EOL>if not isinstance(addrbinding, SoapAddressBinding):<EOL><INDENT>raise ValueError('<STR_LIT>')        <EOL><DEDENT>callinfo.location = addrbinding.location<EOL>soapbinding = binding.findBinding(SoapBinding)<EOL>if soapbinding is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>callinfo.transport = soapbinding.transport<EOL>callinfo.style = soapbinding.style or '<STR_LIT>'<EOL>soap_op_binding = opbinding.findBinding(SoapOperationBinding)<EOL>if soap_op_binding is not None:<EOL><INDENT>callinfo.soapAction = soap_op_binding.soapAction<EOL>callinfo.style = soap_op_binding.style or callinfo.style<EOL><DEDENT>parameterOrder = operation.parameterOrder<EOL>if operation.input is not None:<EOL><INDENT>message = messages[operation.input.message]<EOL>msgrole = opbinding.input<EOL>mime = msgrole.findBinding(MimeMultipartRelatedBinding)<EOL>if mime is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>for item in msgrole.findBindings(SoapHeaderBinding):<EOL><INDENT>part = messages[item.message].parts[item.part]<EOL>header = callinfo.addInHeaderInfo(<EOL>part.name,<EOL>part.element or part.type,<EOL>item.namespace,<EOL>element_type = part.element and <NUM_LIT:1> or <NUM_LIT:0><EOL>)<EOL>header.encodingStyle = item.encodingStyle<EOL><DEDENT>body = msgrole.findBinding(SoapBodyBinding)<EOL>if body is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>callinfo.encodingStyle = body.encodingStyle<EOL>callinfo.namespace = body.namespace<EOL>callinfo.use = body.use<EOL>if body.parts is not None:<EOL><INDENT>parts = []<EOL>for name in body.parts:<EOL><INDENT>parts.append(message.parts[name])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>parts = list(message.parts.values())<EOL><DEDENT>for part in parts:<EOL><INDENT>callinfo.addInParameter(<EOL>part.name,<EOL>part.element or part.type,<EOL>element_type = part.element and <NUM_LIT:1> or <NUM_LIT:0><EOL>)<EOL><DEDENT><DEDENT><DEDENT>if operation.output is not None:<EOL><INDENT>try:<EOL><INDENT>message = messages[operation.output.message]<EOL><DEDENT>except KeyError:<EOL><INDENT>if self.strict:<EOL><INDENT>raise RuntimeError(<EOL>"<STR_LIT>" %<EOL>operation.output.message)<EOL><DEDENT>else:<EOL><INDENT>message = wsdl.addMessage(operation.output.message)<EOL>print("<STR_LIT>","<STR_LIT>","<STR_LIT>")<EOL>print("<STR_LIT>", operation.output.message)<EOL><DEDENT><DEDENT>msgrole = opbinding.output<EOL>mime = msgrole.findBinding(MimeMultipartRelatedBinding)<EOL>if mime is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>for item in msgrole.findBindings(SoapHeaderBinding):<EOL><INDENT>part = messages[item.message].parts[item.part]<EOL>header = callinfo.addOutHeaderInfo(<EOL>part.name,<EOL>part.element or part.type,<EOL>item.namespace,<EOL>element_type = part.element and <NUM_LIT:1> or <NUM_LIT:0><EOL>)<EOL>header.encodingStyle = item.encodingStyle<EOL><DEDENT>body = msgrole.findBinding(SoapBodyBinding)<EOL>if body is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>callinfo.encodingStyle = body.encodingStyle<EOL>callinfo.namespace = body.namespace<EOL>callinfo.use = body.use<EOL>if body.parts is not None:<EOL><INDENT>parts = []<EOL>for name in body.parts:<EOL><INDENT>parts.append(message.parts[name])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>parts = list(message.parts.values())<EOL><DEDENT>if parts:<EOL><INDENT>for part in parts:<EOL><INDENT>callinfo.addOutParameter(<EOL>part.name,<EOL>part.element or part.type,<EOL>element_type = part.element and <NUM_LIT:1> or <NUM_LIT:0><EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return callinfo<EOL>
Return a SOAPCallInfo given a WSDL port and operation name.