Exemplo n.º 1
0
            internal URTComplexType(String name, String urlNS, String ns, String encodedNS,
                                    SchemaBlockType blockDefault, bool bSUDSType, bool bAnonymous, WsdlParser parser, URTNamespace xns)
            : base(name, urlNS, ns, encodedNS)
            {
                Util.Log("URTComplexType.URTComplexType name "+this.GetHashCode()+" "+name+" urlNS "+urlNS+" ns "+ns+" encodedNS "+encodedNS+" bSUDStype "+bSUDSType+" bAnonymous "+bAnonymous);
                _baseTypeName = null;
                _baseTypeXmlNS = null;
                _baseType = null;
                _connectURLs = null;
                _bStruct = !bSUDSType;
                _blockType = blockDefault;
                _bSUDSType = bSUDSType;
                _bAnonymous = bAnonymous;
                Debug.Assert(bAnonymous == false || _bSUDSType == false);
                _fieldString = null;
                _fields = new ArrayList();
                _methods = new ArrayList();
                _implIFaces = new ArrayList();
                _implIFaceNames = new ArrayList();
                _sudsType = SUDSType.None;              
                _parser = parser;

                int index = name.IndexOf('+');
                if (index > 0)
                {
                    // Nested type see if outer type has been added to namespace
                    String outerType = parser.Atomize(name.Substring(0,index));
                    URTComplexType cs = xns.LookupComplexType(outerType);
                    if (cs == null)
                    {
                        URTComplexType newCs = new URTComplexType(outerType, urlNS, ns, encodedNS, blockDefault, bSUDSType, bAnonymous, parser, xns);
                        Util.Log("URTComplexType.URTComplexType add outerType to namespace "+outerType+" nestedname "+name);
                        xns.AddComplexType(newCs);
                    }
                }


                if (xns.UrtType == UrtType.Interop)
                {
                    // Interop class names can have '.', replace these with '_', and set wire name to original type name.
                    index = name.LastIndexOf('.');
                    if (index > -1)
                    {
                        // class names can't have '.' so replace with '$'. Use xmlType attribute to send original name on wire.
                        _wireType = name;
                        Name = name.Replace(".", "_");
                        SearchName = name;
                    }
                }

            }
Exemplo n.º 2
0
        internal String GetTypeString(String curNS, bool bNS, URTNamespace urtNS, String typeName, String typeNS) 
        {
            Util.Log("WsdlParser.GetTypeString Entry curNS "+curNS+" bNS "+bNS+" URTNamespace "+urtNS.Name+" typeName "+typeName+" typeNS "+typeNS);
            String type;

            URTComplexType ct = urtNS.LookupComplexType(typeName);
            if (ct != null && ct.IsArray())
            {
                if (ct.GetArray() == null)
                    ct.ResolveArray();
                String arrayName = ct.GetArray();
                URTNamespace arrayNS = ct.GetArrayNS();
                StringBuilder sb = new StringBuilder(50);
                if (arrayNS.EncodedNS != null && Qualify(urtNS.EncodedNS, arrayNS.EncodedNS))
                {
                    sb.Append(WsdlParser.IsValidCSAttr(arrayNS.EncodedNS));
                    sb.Append('.');
                }
                sb.Append(WsdlParser.IsValidCSAttr(arrayName));
                type = sb.ToString();
            }
            else
            {
                String encodedNS = null;
                if (urtNS.UrtType == UrtType.Interop)
                    encodedNS = urtNS.EncodedNS;
                else
                    encodedNS = typeNS;

                if (bNS && Qualify(encodedNS, curNS))
                {
                    StringBuilder sb = new StringBuilder(50);
                    if (encodedNS != null)
                    {
                        sb.Append(WsdlParser.IsValidCSAttr(encodedNS));
                        sb.Append('.');
                    }
                    sb.Append(WsdlParser.IsValidCSAttr(typeName));
                    type = sb.ToString();
                }
                else
                {
                    type = typeName;
                }

            }

            int index = type.IndexOf('+');
            if (index > 0)
            {
                // nested type, replace + with . Should be done earlier when forming names
                if (bNS)
                    type = type.Replace('+', '.');
                else
                    type = type.Substring(0,index);
            }


            Util.Log("WsdlParser.GetTypeString Exit type "+type);              
            return(type);
        }
Exemplo n.º 3
0
        // Parses a class
        private void ParseClass(URTNamespace parsingNamespace)
        {
            Util.Log("SdlParser.ParseClass");
            String className = LookupAttribute(s_nameString, null, false);
            bool bUnique = false;
            if((className == s_emptyString) && (_parsingInput.UniqueType == null))
            {
                className = _parsingInput.Name;
                bUnique = true;
            }
            URTComplexType parsingComplexType = parsingNamespace.LookupComplexType(className);
            if(parsingComplexType == null)
            {
                parsingComplexType = new URTComplexType(className, parsingNamespace.Namespace,
                                                        parsingNamespace.EncodedNS, _blockDefault,
                                                        true, false);
                if(_bWrappedProxy)
                {
                    parsingComplexType.SUDSType = SUDSType.ClientProxy;

                    if (_parsingInput.Location.Length > 0)
                    {
                        if (parsingComplexType.ConnectURLs == null)
                            parsingComplexType.ConnectURLs = new ArrayList(10);
                        parsingComplexType.ConnectURLs.Add(_parsingInput.Location);
                    }
                }
                
                parsingNamespace.AddComplexType(parsingComplexType);
            }
            if(bUnique)
            {
                _parsingInput.UniqueType = parsingComplexType;
            }
            if(parsingComplexType.Methods.Count > 0)
            {
                SkipXmlElement();
            }
            else
            {
                parsingComplexType.IsSUDSType = true;
                int curDepth = _XMLReader.Depth;
                ReadNextXmlElement();
                while(_XMLReader.Depth > curDepth)
                {
                    if(MatchingNamespace(s_sudsNamespaceString))
                    {
                        String elmName = _XMLReader.LocalName;
                        if(MatchingStrings(elmName, s_extendsString))
                        {
                            String nameValue = LookupAttribute(s_nameString, null, true);
                            String nameValueNS = ParseQName(ref nameValue);
                            parsingComplexType.Extends(nameValue, nameValueNS);

                            //Set up extend class so that it is marked as the correct SUDSType
                            URTNamespace extendsNamespace = LookupNamespace(nameValueNS);                   
                            if (extendsNamespace == null)
                                extendsNamespace = new URTNamespace(nameValueNS, this);                     

                            URTComplexType extendsComplexType = extendsNamespace.LookupComplexType(nameValue);                  
                            if(extendsComplexType == null)
                            {
                                extendsComplexType = new URTComplexType(nameValue, extendsNamespace.Namespace, extendsNamespace.EncodedNS, _blockDefault ,true, false);
                                extendsNamespace.AddComplexType(extendsComplexType);
                            }
                            else
                                extendsComplexType.IsSUDSType = true;

                            if (_bWrappedProxy)
                                extendsComplexType.SUDSType = SUDSType.ClientProxy;
                            else
                                extendsComplexType.SUDSType = SUDSType.MarshalByRef;

                            // Only top of inheritance hierarchy is marked
                            //parsingComplexType.SUDSType = SUDSType.None;  

                        }
                        else if(MatchingStrings(elmName, s_implementsString))
                        {
                            String nameValue = LookupAttribute(s_nameString, null, true);
                            String nameValueNS = ParseQName(ref nameValue);
                            parsingComplexType.Implements(nameValue, nameValueNS, this);
                        }
                        else if(MatchingStrings(elmName, s_addressesString))
                        {
                            ParseAddresses(parsingComplexType);
                            continue;
                        }
                        else if(MatchingStrings(elmName, s_requestResponseString))
                        {
                            ParseRRMethod(parsingComplexType, null);
                            continue;
                        }
                        else if(MatchingStrings(elmName, s_onewayString))
                        {
                            ParseOnewayMethod(parsingComplexType, null);
                            continue;
                        }
                        else
                            goto SkipXMLNode;
                    }
                    else
                        goto SkipXMLNode;

                    // Read next element
                    ReadNextXmlElement();
                    continue;

        SkipXMLNode:
                    // Ignore others elements such as annotations
                    SkipXmlElement();
                }
            }

            return;
        }
 internal string GetTypeString(string curNS, bool bNS, URTNamespace urtNS, string typeName, string typeNS)
 {
     string str;
     URTComplexType complexType = urtNS.LookupComplexType(typeName);
     if ((complexType != null) && complexType.IsArray())
     {
         if (complexType.GetArray() == null)
         {
             complexType.ResolveArray();
         }
         string array = complexType.GetArray();
         URTNamespace arrayNS = complexType.GetArrayNS();
         StringBuilder builder = new StringBuilder(50);
         if ((arrayNS.EncodedNS != null) && this.Qualify(urtNS.EncodedNS, arrayNS.EncodedNS))
         {
             builder.Append(IsValidCSAttr(arrayNS.EncodedNS));
             builder.Append('.');
         }
         builder.Append(IsValidCSAttr(array));
         str = builder.ToString();
     }
     else
     {
         string encodedNS = null;
         if (urtNS.UrtType == UrtType.Interop)
         {
             encodedNS = urtNS.EncodedNS;
         }
         else
         {
             encodedNS = typeNS;
         }
         if (bNS && this.Qualify(encodedNS, curNS))
         {
             StringBuilder builder2 = new StringBuilder(50);
             if (encodedNS != null)
             {
                 builder2.Append(IsValidCSAttr(encodedNS));
                 builder2.Append('.');
             }
             builder2.Append(IsValidCSAttr(typeName));
             str = builder2.ToString();
         }
         else
         {
             str = typeName;
         }
     }
     int index = str.IndexOf('+');
     if (index <= 0)
     {
         return str;
     }
     if (bNS)
     {
         return str.Replace('+', '.');
     }
     return str.Substring(0, index);
 }
Exemplo n.º 5
0
        // Parses complex types
        private URTComplexType ParseComplexType(URTNamespace parsingNamespace, String typeName)
        {
            Util.Log("SdlParser.ParseComplexType NS "+parsingNamespace+" typeName "+typeName);                                  
            // Lookup the name of the type and the base type from which it derives
            if(typeName == null)
                typeName = LookupAttribute(s_nameString, null, true);
            URTComplexType parsingComplexType = parsingNamespace.LookupComplexType(typeName);
            if(parsingComplexType == null)
            {
                parsingComplexType = new URTComplexType(typeName, parsingNamespace.Namespace,
                    parsingNamespace.EncodedNS, _blockDefault,
                    false, typeName != null);
                parsingNamespace.AddComplexType(parsingComplexType);
            }
            String baseType = LookupAttribute(s_baseString, null, false);
            if(!MatchingStrings(baseType, s_emptyString))
            {
                String baseNS = ParseQName(ref baseType);
                //if the type exists can this occur twice.
                parsingComplexType.Extends(baseType, baseNS);
            }

            if(parsingComplexType.Fields.Count > 0)
            {
                SkipXmlElement();
            }
            else
            {
                int curDepth = _XMLReader.Depth;
                ReadNextXmlElement();

                int fieldNum = 0;
                String elementName;
                while(_XMLReader.Depth > curDepth)
                {
                    elementName = _XMLReader.LocalName;
                    if(MatchingStrings(elementName, s_elementString))
                    {
                        ParseElementField(parsingNamespace, parsingComplexType, fieldNum);
                        ++fieldNum;
                        continue;
                    }
                    else if(MatchingStrings(elementName, s_attributeString))
                    {
                        ParseAttributeField(parsingNamespace, parsingComplexType);
                        continue;
                    }
                    else if(MatchingStrings(elementName, s_allString))
                    {
                        parsingComplexType.BlockType = SchemaBlockType.ALL;
                    }
                    else if(MatchingStrings(elementName, s_sequenceString))
                    {
                        parsingComplexType.BlockType = SchemaBlockType.SEQUENCE;
                    }
                    else if(MatchingStrings(elementName, s_choiceString))
                    {
                        parsingComplexType.BlockType = SchemaBlockType.CHOICE;
                    }
                    else
                    {
                        // Ignore others elements such as annotations
                        SkipXmlElement();
                        continue;
                    }

                    // Read next element
                    ReadNextXmlElement();
                }
            }

            return(parsingComplexType);
        }