MapSchemaTypesToCSharpTypes() private method

private MapSchemaTypesToCSharpTypes ( String xsdType ) : String
xsdType String
return String
Ejemplo n.º 1
0
            // 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));
                        }
                    }
                }
            }
 protected void ResolveWsdlParams(WsdlParser parser, string targetNS, string targetName, bool bRequest, WsdlParser.WsdlMethodInfo wsdlMethodInfo)
 {
     int length;
     this._wsdlMethodInfo = wsdlMethodInfo;
     this._paramNamesOrder = this._wsdlMethodInfo.paramNamesOrder;
     if (this._wsdlMethodInfo.bProperty)
     {
         length = 1;
     }
     else if (bRequest)
     {
         length = wsdlMethodInfo.inputNames.Length;
     }
     else
     {
         length = wsdlMethodInfo.outputNames.Length;
     }
     for (int i = 0; i < length; i++)
     {
         WsdlParser.URTParamType oUT;
         string str6;
         string str7;
         string str = null;
         string str2 = null;
         string name = null;
         string propertyType = null;
         string propertyNs = null;
         if (this._wsdlMethodInfo.bProperty)
         {
             propertyType = wsdlMethodInfo.propertyType;
             propertyNs = wsdlMethodInfo.propertyNs;
             oUT = WsdlParser.URTParamType.OUT;
         }
         else if (bRequest && !this._wsdlMethodInfo.bProperty)
         {
             str = wsdlMethodInfo.inputElements[i];
             str2 = wsdlMethodInfo.inputElementsNs[i];
             name = wsdlMethodInfo.inputNames[i];
             string text1 = wsdlMethodInfo.inputNamesNs[i];
             propertyType = wsdlMethodInfo.inputTypes[i];
             propertyNs = wsdlMethodInfo.inputTypesNs[i];
             oUT = WsdlParser.URTParamType.IN;
         }
         else
         {
             str = wsdlMethodInfo.outputElements[i];
             str2 = wsdlMethodInfo.outputElementsNs[i];
             name = wsdlMethodInfo.outputNames[i];
             string text2 = wsdlMethodInfo.outputNamesNs[i];
             propertyType = wsdlMethodInfo.outputTypes[i];
             propertyNs = wsdlMethodInfo.outputTypesNs[i];
             oUT = WsdlParser.URTParamType.OUT;
         }
         if ((str == null) || (str.Length == 0))
         {
             str6 = propertyType;
             str7 = propertyNs;
         }
         else
         {
             str6 = str;
             str7 = str2;
         }
         WsdlParser.URTNamespace urtNamespace = parser.LookupNamespace(str7);
         if (urtNamespace == null)
         {
             throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveSchemaNS"), new object[] { str7, str6 }));
         }
         WsdlParser.URTComplexType complexType = urtNamespace.LookupComplexType(str6);
         if ((complexType != null) && complexType.IsArray())
         {
             if (complexType.GetArray() == null)
             {
                 complexType.ResolveArray();
             }
             string array = complexType.GetArray();
             WsdlParser.URTNamespace arrayNS = complexType.GetArrayNS();
             this.AddParam(new WsdlParser.URTParam(name, array, arrayNS.Name, arrayNS.EncodedNS, oUT, true, parser, arrayNS));
         }
         else if (urtNamespace.UrtType == UrtType.Xsd)
         {
             string typeName = parser.MapSchemaTypesToCSharpTypes(str6);
             this.AddParam(new WsdlParser.URTParam(name, typeName, urtNamespace.Namespace, urtNamespace.EncodedNS, oUT, true, parser, urtNamespace));
         }
         else
         {
             string str10 = null;
             if (complexType != null)
             {
                 str10 = complexType.Name;
             }
             else
             {
                 WsdlParser.URTSimpleType simpleType = urtNamespace.LookupSimpleType(str6);
                 if (simpleType != null)
                 {
                     str10 = simpleType.Name;
                 }
                 else
                 {
                     str10 = str6;
                 }
             }
             this.AddParam(new WsdlParser.URTParam(name, str10, urtNamespace.Namespace, urtNamespace.EncodedNS, oUT, true, parser, urtNamespace));
         }
     }
 }