internal OnewayMethod(WsdlMethodInfo wsdlMethodInfo, URTComplexType complexType) : base (wsdlMethodInfo.methodName, wsdlMethodInfo.soapAction, wsdlMethodInfo.methodAttributes, complexType) { Util.Log("OnewayMethod.OnewayMethod WsdlMethodInfo name "+wsdlMethodInfo.methodName+" soapAction "+wsdlMethodInfo.soapAction); _wsdlMethodInfo = wsdlMethodInfo; _messageElementName = null; _messageElementNS = null; }
// Constructor internal RRMethod(WsdlMethodInfo wsdlMethodInfo, URTComplexType complexType) : base (wsdlMethodInfo.methodName, wsdlMethodInfo.soapAction, wsdlMethodInfo.methodAttributes, complexType) { Util.Log("RRMethod.RRMethod WsdlMethodInfo name "+wsdlMethodInfo.methodName+" soapAction "+wsdlMethodInfo.soapAction); _wsdlMethodInfo = wsdlMethodInfo; _requestElementName = null; _requestElementNS = null; _responseElementName = null; _responseElementNS = null; }
// Helper method used by Resolve protected void ResolveWsdlParams(WsdlParser parser, String targetNS, String targetName, bool bRequest, WsdlMethodInfo wsdlMethodInfo) { Util.Log("URTMethod.ResolveWsdlParams targetName "+targetName+" targetNS "+targetNS+" bRequest "+bRequest+" wsdlMethodInfo "+wsdlMethodInfo); _wsdlMethodInfo = wsdlMethodInfo; _paramNamesOrder = _wsdlMethodInfo.paramNamesOrder; int length; if (_wsdlMethodInfo.bProperty) length = 1; else if (bRequest) length = wsdlMethodInfo.inputNames.Length; else length = wsdlMethodInfo.outputNames.Length; for (int i=0; i<length; i++) { String element = null; String elementNs = null; String name = null; String nameNs = null; String typeName = null;; String typeNameNs = null;; URTParamType pType; if (_wsdlMethodInfo.bProperty) { typeName = wsdlMethodInfo.propertyType; typeNameNs = wsdlMethodInfo.propertyNs; pType = URTParamType.OUT; } else if (bRequest && !_wsdlMethodInfo.bProperty) { element = wsdlMethodInfo.inputElements[i]; elementNs = wsdlMethodInfo.inputElementsNs[i]; name = wsdlMethodInfo.inputNames[i]; nameNs = wsdlMethodInfo.inputNamesNs[i]; typeName = wsdlMethodInfo.inputTypes[i]; typeNameNs = wsdlMethodInfo.inputTypesNs[i]; pType = URTParamType.IN; } else { element = wsdlMethodInfo.outputElements[i]; elementNs = wsdlMethodInfo.outputElementsNs[i]; name = wsdlMethodInfo.outputNames[i]; nameNs = wsdlMethodInfo.outputNamesNs[i]; typeName = wsdlMethodInfo.outputTypes[i]; typeNameNs = wsdlMethodInfo.outputTypesNs[i]; pType = URTParamType.OUT; } String actualType; String actualTypeNs; if ((element == null) || element.Length == 0) { actualType = typeName; actualTypeNs = typeNameNs; } else { actualType = element; actualTypeNs = elementNs; } Util.Log("URTMethod.ResolveWsdlParams actualType "+actualType+" actualTypeNs "+actualTypeNs); URTNamespace ns = parser.LookupNamespace(actualTypeNs); if (ns == null) { throw new SUDSParserException( String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveSchemaNS"), actualTypeNs, actualType)); } URTComplexType ct = ns.LookupComplexType(actualType); if (ct != null && ct.IsArray()) { if (ct.GetArray() == null) ct.ResolveArray(); String arrayName = ct.GetArray(); URTNamespace arrayNS = ct.GetArrayNS(); AddParam(new URTParam(name, arrayName, arrayNS.Name, arrayNS.EncodedNS, pType, true, parser, arrayNS)); } else { Util.Log("URTMethod.ResolveWsdlParams actualType 2 UrtType "+((Enum)ns.UrtType).ToString()); if (ns.UrtType == UrtType.Xsd) { String clrtypeName = parser.MapSchemaTypesToCSharpTypes(actualType); AddParam(new URTParam(name, clrtypeName, ns.Namespace, ns.EncodedNS, pType, true, parser, ns)); } else { String foundTypeName = null; if (ct != null) { foundTypeName = ct.Name; } else { URTSimpleType stype = ns.LookupSimpleType(actualType); if (stype != null) { foundTypeName = stype.Name; } else { foundTypeName = actualType; /* throw new SUDSParserException( String.Format(CoreChannel.GetResourceString("Remoting_Suds_CantResolveTypeInNS"), actualType, ns.Name)); */ } } //typeNS.RemoveComplexType(type); AddParam(new URTParam(name, foundTypeName, ns.Namespace, ns.EncodedNS, pType, true, parser, ns)); } } } }
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_", StringComparison.Ordinal) && methodInfo.methodName.Length > 4)) bGet = true; else if ((methodInfo.methodName.StartsWith("set_", StringComparison.Ordinal) && 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(CultureInfo.CurrentCulture, 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(CultureInfo.CurrentCulture, 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(CultureInfo.CurrentCulture, 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(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidPortType"), content.element)); } //methodInfo.Dump(); } //no porttype } } return methodInfos; }
private ArrayList ResolveWsdlMethodInfo(WsdlBinding binding) { ArrayList list = new ArrayList(10); Hashtable hashtable = new Hashtable(3); for (int i = 0; i < binding.operations.Count; i++) { bool flag = false; bool flag2 = false; WsdlBindingOperation operation = (WsdlBindingOperation) binding.operations[i]; if (operation.soapOperation == null) { continue; } WsdlMethodInfo info = new WsdlMethodInfo { methodName = operation.name, methodNameNs = operation.nameNs, methodAttributes = operation.methodAttributes }; this.AddNewNamespace(operation.nameNs); WsdlBindingSoapOperation soapOperation = operation.soapOperation; if (info.methodName.StartsWith("get_", StringComparison.Ordinal) && (info.methodName.Length > 4)) { flag = true; } else if (info.methodName.StartsWith("set_", StringComparison.Ordinal) && (info.methodName.Length > 4)) { flag2 = true; } if (flag || flag2) { bool flag3 = false; string str = info.methodName.Substring(4); WsdlMethodInfo info2 = (WsdlMethodInfo) hashtable[str]; if (info2 == null) { hashtable[str] = info; list.Add(info); info2 = info; info.propertyName = str; info.bProperty = true; flag3 = true; } if (flag) { info2.bGet = true; info2.soapActionGet = soapOperation.soapAction; } else { info2.bSet = true; info2.soapActionSet = soapOperation.soapAction; } if (flag3) { goto Label_016C; } continue; } list.Add(info); Label_016C: info.soapAction = soapOperation.soapAction; WsdlPortType type = (WsdlPortType) this.wsdlPortTypes[binding.type]; if ((type == null) || (type.operations.Count != binding.operations.Count)) { throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidPortType"), new object[] { binding.type })); } WsdlPortTypeOperation operation3 = null; foreach (WsdlBindingOperationSection section in operation.sections) { if (MatchingStrings(section.elementName, s_inputString)) { operation3 = (WsdlPortTypeOperation) type.sections[section.name]; if (operation3 == null) { int length = section.name.LastIndexOf("Request"); if (length > 0) { string str2 = section.name.Substring(0, length); operation3 = (WsdlPortTypeOperation) type.sections[str2]; } } if (((operation3 != null) && (operation3.parameterOrder != null)) && (operation3.parameterOrder.Length > 0)) { info.paramNamesOrder = operation3.parameterOrder.Split(new char[] { ' ' }); } foreach (WsdlBindingSoapBody body in section.extensions) { if ((body.namespaceUri != null) || (body.namespaceUri.Length > 0)) { info.inputMethodNameNs = body.namespaceUri; } } } else if (MatchingStrings(section.elementName, s_outputString)) { foreach (WsdlBindingSoapBody body2 in section.extensions) { if ((body2.namespaceUri != null) || (body2.namespaceUri.Length > 0)) { info.outputMethodNameNs = body2.namespaceUri; } } } } if (operation3 != null) { foreach (WsdlPortTypeOperationContent content in operation3.contents) { if (MatchingStrings(content.element, s_inputString)) { info.inputMethodName = content.message; if (info.inputMethodNameNs == null) { info.inputMethodNameNs = content.messageNs; } WsdlMessage message = (WsdlMessage) this.wsdlMessages[content.message]; if (message == null) { throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlMissingMessage"), new object[] { content.message })); } if (message.parts != null) { info.inputNames = new string[message.parts.Count]; info.inputNamesNs = new string[message.parts.Count]; info.inputElements = new string[message.parts.Count]; info.inputElementsNs = new string[message.parts.Count]; info.inputTypes = new string[message.parts.Count]; info.inputTypesNs = new string[message.parts.Count]; for (int j = 0; j < message.parts.Count; j++) { info.inputNames[j] = ((WsdlMessagePart) message.parts[j]).name; info.inputNamesNs[j] = ((WsdlMessagePart) message.parts[j]).nameNs; this.AddNewNamespace(info.inputNamesNs[j]); info.inputElements[j] = ((WsdlMessagePart) message.parts[j]).element; info.inputElementsNs[j] = ((WsdlMessagePart) message.parts[j]).elementNs; this.AddNewNamespace(info.inputElementsNs[j]); info.inputTypes[j] = ((WsdlMessagePart) message.parts[j]).typeName; info.inputTypesNs[j] = ((WsdlMessagePart) message.parts[j]).typeNameNs; this.AddNewNamespace(info.inputTypesNs[j]); if ((info.bProperty && (info.inputTypes[j] != null)) && (info.propertyType == null)) { info.propertyType = info.inputTypes[j]; info.propertyNs = info.inputTypesNs[j]; this.AddNewNamespace(info.propertyNs); } } } } else { if (!MatchingStrings(content.element, s_outputString)) { throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidPortType"), new object[] { content.element })); } info.outputMethodName = content.message; if (info.outputMethodNameNs == null) { info.outputMethodNameNs = content.messageNs; } WsdlMessage message2 = (WsdlMessage) this.wsdlMessages[content.message]; if (message2 == null) { throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlMissingMessage"), new object[] { content.message })); } if (message2.parts != null) { info.outputNames = new string[message2.parts.Count]; info.outputNamesNs = new string[message2.parts.Count]; info.outputElements = new string[message2.parts.Count]; info.outputElementsNs = new string[message2.parts.Count]; info.outputTypes = new string[message2.parts.Count]; info.outputTypesNs = new string[message2.parts.Count]; for (int k = 0; k < message2.parts.Count; k++) { info.outputNames[k] = ((WsdlMessagePart) message2.parts[k]).name; info.outputNamesNs[k] = ((WsdlMessagePart) message2.parts[k]).nameNs; this.AddNewNamespace(info.outputNamesNs[k]); info.outputElements[k] = ((WsdlMessagePart) message2.parts[k]).element; info.outputElementsNs[k] = ((WsdlMessagePart) message2.parts[k]).elementNs; this.AddNewNamespace(info.outputElementsNs[k]); info.outputTypes[k] = ((WsdlMessagePart) message2.parts[k]).typeName; info.outputTypesNs[k] = ((WsdlMessagePart) message2.parts[k]).typeNameNs; this.AddNewNamespace(info.outputTypesNs[k]); if ((info.bProperty && (info.outputTypes[k] != null)) && (info.propertyType == null)) { info.propertyType = info.outputTypes[k]; info.propertyNs = info.outputTypesNs[k]; this.AddNewNamespace(info.outputTypesNs[k]); } } } } } } } return list; }