private ArrayList ResolveWsdlMethodInfo(WsdlBinding binding) { Util.Log("WsdlParser.ResolveWsdlMethodInfo "+binding.name); ArrayList methodInfos = new ArrayList(10); Hashtable propertyMethod = new Hashtable(3); for (int i=0; i<binding.operations.Count; i++) { bool bGet = false; bool bSet = false; WsdlBindingOperation op = (WsdlBindingOperation)binding.operations[i]; if (op.soapOperation != null) { WsdlMethodInfo methodInfo = new WsdlMethodInfo(); methodInfo.methodName = op.name; methodInfo.methodNameNs = op.nameNs; methodInfo.methodAttributes = op.methodAttributes; AddNewNamespace(op.nameNs); WsdlBindingSoapOperation opSoap = (WsdlBindingSoapOperation)op.soapOperation; if ((methodInfo.methodName.StartsWith("get_") && methodInfo.methodName.Length > 4)) bGet = true; else if ((methodInfo.methodName.StartsWith("set_") && methodInfo.methodName.Length > 4)) bSet = true; if (bGet || bSet) { bool bNew = false; String propertyName = methodInfo.methodName.Substring(4); WsdlMethodInfo propertyMethodInfo = (WsdlMethodInfo)propertyMethod[propertyName]; if (propertyMethodInfo == null) { propertyMethod[propertyName] = methodInfo; methodInfos.Add(methodInfo); propertyMethodInfo = methodInfo; methodInfo.propertyName = propertyName; methodInfo.bProperty = true; bNew = true; } if (bGet) { propertyMethodInfo.bGet = true; propertyMethodInfo.soapActionGet = opSoap.soapAction; } else { propertyMethodInfo.bSet = true; propertyMethodInfo.soapActionSet = opSoap.soapAction; //propertyMethodInfo.Dump(); } if (!bNew) continue; //already processed this property } else methodInfos.Add(methodInfo); methodInfo.soapAction = opSoap.soapAction; WsdlPortType portType = (WsdlPortType)wsdlPortTypes[binding.type]; if ((portType == null) || (portType.operations.Count != binding.operations.Count)) { throw new SUDSParserException( String.Format(CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidPortType"), binding.type)); } // PortType operations are obtained by the <binding><operation><input name = porttype operation> WsdlPortTypeOperation portTypeOp = null; foreach (WsdlBindingOperationSection opSec in op.sections) { if (MatchingStrings(opSec.elementName, s_inputString)) { portTypeOp = (WsdlPortTypeOperation)portType.sections[opSec.name]; Util.Log("WsdlParser.ResolveWsdlMethodInfo find portTypeOp 1 "+opSec.name+" portTypeOp "+portTypeOp); if (portTypeOp == null) { //this is for interop testing because other implementations are using the opSec.name wrong. // a "Request" is not being added to the end of the name. int index = opSec.name.LastIndexOf("Request"); if (index > 0) { String newOpName = opSec.name.Substring(0, index); portTypeOp = (WsdlPortTypeOperation)portType.sections[newOpName]; Util.Log("WsdlParser.ResolveWsdlMethodInfo find portTypeOp 2 "+newOpName+" portTypeOp "+portTypeOp); } } if (portTypeOp != null && portTypeOp.parameterOrder != null && portTypeOp.parameterOrder.Length > 0) { methodInfo.paramNamesOrder = portTypeOp.parameterOrder.Split(' '); } foreach (WsdlBindingSoapBody body in opSec.extensions) { if (body.namespaceUri != null || body.namespaceUri.Length > 0) methodInfo.inputMethodNameNs = body.namespaceUri; } } else if (MatchingStrings(opSec.elementName, s_outputString)) { foreach (WsdlBindingSoapBody body in opSec.extensions) { if (body.namespaceUri != null || body.namespaceUri.Length > 0) methodInfo.outputMethodNameNs = body.namespaceUri; } } } /* if (portTypeOp == null) { throw new SUDSParserException( String.Format(CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidPortType"), binding.type)); } */ if (portTypeOp != null) { foreach (WsdlPortTypeOperationContent content in portTypeOp.contents) { if (MatchingStrings(content.element, s_inputString)) { methodInfo.inputMethodName = content.message; if (methodInfo.inputMethodNameNs == null) methodInfo.inputMethodNameNs = content.messageNs; WsdlMessage message = (WsdlMessage)wsdlMessages[content.message]; if (message == null) { throw new SUDSParserException( String.Format(CoreChannel.GetResourceString("Remoting_Suds_WsdlMissingMessage"), content.message)); } else { if (message.parts != null) { methodInfo.inputNames = new String[message.parts.Count]; methodInfo.inputNamesNs = new String[message.parts.Count]; methodInfo.inputElements = new String[message.parts.Count]; methodInfo.inputElementsNs = new String[message.parts.Count]; methodInfo.inputTypes = new String[message.parts.Count]; methodInfo.inputTypesNs = new String[message.parts.Count]; for (int ip=0; ip<message.parts.Count; ip++) { methodInfo.inputNames[ip] = ((WsdlMessagePart)message.parts[ip]).name; methodInfo.inputNamesNs[ip] = ((WsdlMessagePart)message.parts[ip]).nameNs; AddNewNamespace(methodInfo.inputNamesNs[ip]); methodInfo.inputElements[ip] = ((WsdlMessagePart)message.parts[ip]).element; methodInfo.inputElementsNs[ip] = ((WsdlMessagePart)message.parts[ip]).elementNs; AddNewNamespace(methodInfo.inputElementsNs[ip]); methodInfo.inputTypes[ip] = ((WsdlMessagePart)message.parts[ip]).typeName; methodInfo.inputTypesNs[ip] = ((WsdlMessagePart)message.parts[ip]).typeNameNs; AddNewNamespace(methodInfo.inputTypesNs[ip]); if (methodInfo.bProperty && methodInfo.inputTypes[ip] != null && methodInfo.propertyType == null) { methodInfo.propertyType = methodInfo.inputTypes[ip]; methodInfo.propertyNs = methodInfo.inputTypesNs[ip]; AddNewNamespace(methodInfo.propertyNs); } } } } } else if (MatchingStrings(content.element, s_outputString)) { methodInfo.outputMethodName = content.message; if (methodInfo.outputMethodNameNs == null) methodInfo.outputMethodNameNs = content.messageNs; WsdlMessage message = (WsdlMessage)wsdlMessages[content.message]; if (message == null) { throw new SUDSParserException( String.Format(CoreChannel.GetResourceString("Remoting_Suds_WsdlMissingMessage"), content.message)); } else { if (message.parts != null) { methodInfo.outputNames = new String[message.parts.Count]; methodInfo.outputNamesNs = new String[message.parts.Count]; methodInfo.outputElements = new String[message.parts.Count]; methodInfo.outputElementsNs = new String[message.parts.Count]; methodInfo.outputTypes = new String[message.parts.Count]; methodInfo.outputTypesNs = new String[message.parts.Count]; for (int ip=0; ip<message.parts.Count; ip++) { methodInfo.outputNames[ip] = ((WsdlMessagePart)message.parts[ip]).name; methodInfo.outputNamesNs[ip] = ((WsdlMessagePart)message.parts[ip]).nameNs; AddNewNamespace(methodInfo.outputNamesNs[ip]); methodInfo.outputElements[ip] = ((WsdlMessagePart)message.parts[ip]).element; methodInfo.outputElementsNs[ip] = ((WsdlMessagePart)message.parts[ip]).elementNs; AddNewNamespace(methodInfo.outputElementsNs[ip]); methodInfo.outputTypes[ip] = ((WsdlMessagePart)message.parts[ip]).typeName; methodInfo.outputTypesNs[ip] = ((WsdlMessagePart)message.parts[ip]).typeNameNs; AddNewNamespace(methodInfo.outputTypesNs[ip]); if (methodInfo.bProperty && methodInfo.outputTypes[ip] != null && methodInfo.propertyType == null) { methodInfo.propertyType = methodInfo.outputTypes[ip]; methodInfo.propertyNs = methodInfo.outputTypesNs[ip]; AddNewNamespace(methodInfo.outputTypesNs[ip]); } } } } } else throw new SUDSParserException( String.Format(CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidPortType"), content.element)); } methodInfo.Dump(); } //no porttype } } return methodInfos; }