/* This method gets triggered when the groupInvoke list gets bound with data */ protected void groupInvokeList_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { wsdlUtilsService.MethodDetails method = (wsdlUtilsService.MethodDetails)e.Item.DataItem; DataList inputParameterDataList = (DataList)e.Item.FindControl("groupInvokeInputParameterList"); DataList outputParameterDataList = (DataList)e.Item.FindControl("groupInvokeOutputParameterList"); inputParameterDataList.DataSource = method.inputParameters; inputParameterDataList.DataBind(); outputParameterDataList.DataSource = method.outputParameters; outputParameterDataList.DataBind(); } }
/* This method extracts method and parameter information provided with an */ /* array of encoded strings representing the method and parameter info. */ private void extractMethodParamInfo(string[] methodsInfo) { if (currentServiceMethodDetails == null) { currentServiceMethodDetails = new List <wsdlUtilsService.MethodDetails>(); } /* First entry in the array is the service name */ currentServiceName = methodsInfo[0]; /* Traverse through the entire methods info array and add them to the */ /* method info list global */ int i = 1; while (i < methodsInfo.Length) { if (methodsInfo[i].Length > 11 && methodsInfo[i].Substring(0, 11).Equals("MethodName:")) { string[] methodNameInfo = methodsInfo[i].Split(new string[] { "MethodName:" }, StringSplitOptions.None); string methodName = methodNameInfo[1]; /* If the method name is Discover, stop */ if (methodName == "Discover") { break; } wsdlUtilsService.MethodDetails methodDetails = new wsdlUtilsService.MethodDetails(); /* Extract the method name and add to the lsit */ methodDetails.methodName = methodName; List <wsdlUtilsService.ParameterDetails> inputParameterDetails = new List <wsdlUtilsService.ParameterDetails>(); List <wsdlUtilsService.ParameterDetails> outputParameterDetails = new List <wsdlUtilsService.ParameterDetails>(); /* Extract the parameters and return types and add to the list */ int j = i + 1; while (true) { if (methodsInfo[j].Length > 11 && methodsInfo[j].Substring(0, 11).Equals("MethodName:")) { break; } if (methodsInfo[j].Length > 11 && methodsInfo[j].Substring(0, 11).Equals("ReturnType:")) { string[] returnTypeInfo = methodsInfo[j].Split(new string[] { "ReturnType:" }, StringSplitOptions.None); string returnTypeName = returnTypeInfo[1]; wsdlUtilsService.ParameterDetails returnParameter = new wsdlUtilsService.ParameterDetails(); returnParameter.parameterType = "ReturnType"; returnParameter.parameterName = returnTypeName; outputParameterDetails.Add(returnParameter); j++; } if (methodsInfo[j].Substring(0, 6).Equals("PName:")) { string[] paramNameInfo = methodsInfo[j].Split(new string[] { "PName:" }, StringSplitOptions.None); string paramName = paramNameInfo[1]; wsdlUtilsService.ParameterDetails inputParameter = new wsdlUtilsService.ParameterDetails(); inputParameter.parameterName = paramName; j++; if (methodsInfo[j].Substring(0, 6).Equals("PType:")) { string[] paramTypeInfo = methodsInfo[j].Split(new string[] { "PType:" }, StringSplitOptions.None); string paramType = paramTypeInfo[1]; inputParameter.parameterType = paramType; inputParameterDetails.Add(inputParameter); j++; } } } methodDetails.inputParameters = inputParameterDetails.ToArray(); methodDetails.outputParameters = outputParameterDetails.ToArray(); currentServiceMethodDetails.Add(methodDetails); i = j; } } }
/* This method extracts method and parameter information provided with an */ /* array of encoded strings representing the method and parameter info. */ private void extractMethodParamInfo(string[] methodsInfo) { if (currentServiceMethodDetails == null) { currentServiceMethodDetails = new List<wsdlUtilsService.MethodDetails>(); } /* First entry in the array is the service name */ currentServiceName = methodsInfo[0]; /* Traverse through the entire methods info array and add them to the */ /* method info list global */ int i = 1; while (i < methodsInfo.Length) { if (methodsInfo[i].Length > 11 && methodsInfo[i].Substring(0, 11).Equals("MethodName:")) { string[] methodNameInfo = methodsInfo[i].Split(new string[] { "MethodName:" }, StringSplitOptions.None); string methodName = methodNameInfo[1]; /* If the method name is Discover, stop */ if (methodName == "Discover") break; wsdlUtilsService.MethodDetails methodDetails = new wsdlUtilsService.MethodDetails(); /* Extract the method name and add to the lsit */ methodDetails.methodName = methodName; List<wsdlUtilsService.ParameterDetails> inputParameterDetails = new List<wsdlUtilsService.ParameterDetails>(); List<wsdlUtilsService.ParameterDetails> outputParameterDetails = new List<wsdlUtilsService.ParameterDetails>(); /* Extract the parameters and return types and add to the list */ int j = i + 1; while (true) { if (methodsInfo[j].Length > 11 && methodsInfo[j].Substring(0, 11).Equals("MethodName:")) break; if (methodsInfo[j].Length > 11 && methodsInfo[j].Substring(0, 11).Equals("ReturnType:")) { string[] returnTypeInfo = methodsInfo[j].Split(new string[] { "ReturnType:" }, StringSplitOptions.None); string returnTypeName = returnTypeInfo[1]; wsdlUtilsService.ParameterDetails returnParameter = new wsdlUtilsService.ParameterDetails(); returnParameter.parameterType = "ReturnType"; returnParameter.parameterName = returnTypeName; outputParameterDetails.Add(returnParameter); j++; } if (methodsInfo[j].Substring(0, 6).Equals("PName:")) { string[] paramNameInfo = methodsInfo[j].Split(new string[] { "PName:" }, StringSplitOptions.None); string paramName = paramNameInfo[1]; wsdlUtilsService.ParameterDetails inputParameter = new wsdlUtilsService.ParameterDetails(); inputParameter.parameterName = paramName; j++; if (methodsInfo[j].Substring(0, 6).Equals("PType:")) { string[] paramTypeInfo = methodsInfo[j].Split(new string[] { "PType:" }, StringSplitOptions.None); string paramType = paramTypeInfo[1]; inputParameter.parameterType = paramType; inputParameterDetails.Add(inputParameter); j++; } } } methodDetails.inputParameters = inputParameterDetails.ToArray(); methodDetails.outputParameters = outputParameterDetails.ToArray(); currentServiceMethodDetails.Add(methodDetails); i = j; } } }