System.Runtime.Remoting.MetadataServices.WsdlParser.MapSchemaTypesToCSharpTypes C# (CSharp) Method

MapSchemaTypesToCSharpTypes() private method

private MapSchemaTypesToCSharpTypes ( String xsdType ) : String
xsdType String
return String
        private String MapSchemaTypesToCSharpTypes(String xsdType)
        {
            Util.Log("SudsConverter.MapSchemaTypesToCSharpTypes Enter  "+xsdType);
            String stype = xsdType; 
            int index = xsdType.IndexOf('[');
            if (index != -1)
                stype = xsdType.Substring(0, index);

            String clrType = SudsConverter.MapXsdToClrTypes(stype);

            if (clrType == null)
                throw new SUDSParserException(
                                             String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveTypeInNS"),
                                                           xsdType, s_schemaNamespaceString));

            // Handle array types
            if (index != -1)
                clrType = clrType + xsdType.Substring(index);
            Util.Log("SudsConverter.MapSchemaTypesToCSharpTypes Exit Type "+clrType);           

            return clrType;
        }

Usage Example

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));
                        }
                    }
                }
            }
All Usage Examples Of System.Runtime.Remoting.MetadataServices.WsdlParser::MapSchemaTypesToCSharpTypes