コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.checkBox1.Checked = true;
            this.dataGridView1.Rows.Clear();
            //this.checkedListBox1.Items.Clear();
            string webservice    = this.webServiceText.Text;
            string package       = this.packagenameText.Text;
            string destpath      = this.destpathText.Text;
            string namespacetext = this.namespaceText.Text;

            parser = new WsdlParser(webservice, package, destpath, namespacetext);
            Dictionary <string, List <XmlSchemaElement> > opList     = parser.parse().Item1;
            Dictionary <string, List <XmlSchemaElement> > outputList = parser.parse().Item2;

            //this.checkedListBox1.Items.Add("ALL",true);
            foreach (string s in opList.Keys)
            {
                string parameters = " ";
                foreach (XmlSchemaElement elem in opList[s])
                {
                    parameters += parser.getListDef(elem) + "  " + elem.Name + ",";
                }
                parameters = parameters.Substring(0, parameters.Length - 1);
                //this.checkedListBox1.Items.Add(s+"("+parameters+")           return:"+parser.getListDef(outputList[s+"Response"][0]),true);
                this.dataGridView1.Rows.Add(true, s, parameters, parser.getListDef(outputList[s + "Response"][0]));
            }
        }
コード例 #2
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal bool Resolve(WsdlParser parser){
                Util.Log("ElementDecl.Resolve "+TypeName+" "+TypeNS);
                // Return immediately for element declaration of primitive types
                if (_bPrimitive)
                    return true;

                // Lookup the type from the element declaration
                URTNamespace typeNS = parser.LookupNamespace(TypeNS);
                if (typeNS == null)
                {
                    throw new SUDSParserException(
                                                 String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveSchemaNS"),
                                                               TypeNS, TypeName));
                }
                BaseType type = typeNS.LookupType(TypeName);
                if (type == null)
                {
                    // Because there might be multiple bindings and some not soap, there can be failures in the non soap bindings.
                    return false; 
                    /*
                    throw new SUDSParserException(
                                                 String.Format(CoreChannel.GetResourceString("Remoting_Suds_CantResolveTypeInNS"),
                                                               TypeName, TypeNS));
                                                               */
                }

                type.ElementName = Name;
                type.ElementNS = Namespace;

                return true;
            }
コード例 #3
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal void ResolveTypes(WsdlParser parser)
            {
                Util.Log("URTComplexType.ResolveTypes "+Name+" _baseTypeName "+_baseTypeName+" IsSUDSType "+IsSUDSType);
                String baseTypeNS = null;
                String baseTypeAssemName = null;
                if (IsArray())
                {
                    ResolveArray();
                    return;
                }

                if (IsSUDSType)
                {
                    // BaseType == null;
                    if (_sudsType == SUDSType.None)
                    {
                        if (_parser._bWrappedProxy)
                            _sudsType = SUDSType.ClientProxy;
                        else
                            _sudsType = SUDSType.MarshalByRef;
                    }
                }

                if (_baseTypeName != null)
                {
                    Util.Log("URTComplexType.ResolveTypes 1 ");
                    UrtType urtType = parser.IsURTExportedType(_baseTypeXmlNS, out baseTypeNS, out baseTypeAssemName);
                    if (urtType == UrtType.UrtSystem || baseTypeNS.StartsWith("System", StringComparison.Ordinal))
                    {
                        _baseType = new SystemType(_baseTypeName, _baseTypeXmlNS, baseTypeNS, baseTypeAssemName);
                    }
                    else
                    {
                        URTNamespace ns = parser.LookupNamespace(_baseTypeXmlNS);
                        if (ns == null)
                        {
                            throw new SUDSParserException(
                                                         String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveSchemaNS"),
                                                                       _baseTypeXmlNS, _baseTypeName));
                        }
                        _baseType = ns.LookupComplexType(_baseTypeName);
                        if (_baseType == null)
                        {
                            _baseType = new SystemType(_baseTypeName, _baseTypeXmlNS, baseTypeNS, baseTypeAssemName);

                            /*
                            throw new SUDSParserException(
                                                         String.Format(CoreChannel.GetResourceString("Remoting_Suds_CantResolveTypeInNS"),
                                                                       _baseTypeName, _baseTypeXmlNS));
                                                                       */
                        }
                    }
                }
                // Top of inheritance hiearchy for a Wrapped proxy is RemotingClientProxy
                if (IsSUDSType)
                {
                    if (_parser._bWrappedProxy)
                    {

                        if (_baseTypeName == null || _baseType is SystemType)
                        {
                            _baseTypeName = "RemotingClientProxy";
                            //<STRIP>_baseTypeXmlNS = "http://schemas.microsoft.com/urt/NSAssem/System.Runtime.Remoting/System.Runtime.Remoting";</STRIP>
                            _baseTypeXmlNS = SoapServices.CodeXmlNamespaceForClrTypeNamespace("System.Runtime.Remoting","System.Runtime.Remoting");
                            baseTypeNS = "System.Runtime.Remoting.Services";
                            baseTypeAssemName = "System.Runtime.Remoting";
                            _baseType = new SystemType(_baseTypeName, _baseTypeXmlNS, baseTypeNS, baseTypeAssemName);
                        }
                    }
                    else if (_baseTypeName == null)
                    {                       
                        _baseTypeName = "MarshalByRefObject";
                        //<STRIP>_baseTypeXmlNS = "http://schemas.microsoft.com/urt/NS/System";</STRIP>
                        _baseTypeXmlNS = SoapServices.CodeXmlNamespaceForClrTypeNamespace("System", null);
                        baseTypeNS = "System";
                        baseTypeAssemName = null;
                        _baseType = new SystemType(_baseTypeName, _baseTypeXmlNS, baseTypeNS, baseTypeAssemName);                        
                    }                   
                }
                else if (_baseType == null)
                {
                    Util.Log("URTComplexType.ResolveTypes 5 ");                                         
                    _baseType = new SystemType("Object", SoapServices.CodeXmlNamespaceForClrTypeNamespace("System", null), "System", null);
                }
                for (int i=0;i<_implIFaceNames.Count;i=i+2)
                {
                    String implIFaceName = (String) _implIFaceNames[i];
                    String implIFaceXmlNS = (String) _implIFaceNames[i+1];
                    String implIFaceNS, implIFaceAssemName;
                    BaseInterface iFace;


                    UrtType iType = parser.IsURTExportedType(implIFaceXmlNS, out implIFaceNS,
                                                             out implIFaceAssemName);

                    if (iType == UrtType.UrtSystem)// && implIFaceNS.StartsWith("System", StringComparison.Ordinal))
                    {
                        iFace = new SystemInterface(implIFaceName, implIFaceXmlNS, implIFaceNS, parser, implIFaceAssemName);
                    }
                    else
                    {
                        URTNamespace ns = parser.LookupNamespace(implIFaceXmlNS);
                        if (ns == null)
                        {
                            throw new SUDSParserException(
                                                         String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveSchemaNS"),
                                                                       implIFaceXmlNS, implIFaceName));
                        }
                        iFace = ns.LookupInterface(implIFaceName);
                        if (iFace == null)
                        {
                            throw new SUDSParserException(
                                                         String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveTypeInNS"),
                                                                       implIFaceName, implIFaceXmlNS));
                        }
                    }
                    _implIFaces.Add(iFace);
                }
                for (int i=0;i<_methods.Count;i++)
                    ((URTMethod) _methods[i]).ResolveTypes(parser);
            }
コード例 #4
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal void Implements(String iFaceName, String iFaceNS, WsdlParser parser)
            {
                Util.Log("URTComplexType.Implements IFaceName "+iFaceName+" iFaceNS "+iFaceNS);
                _implIFaceNames.Add(iFaceName);
                _implIFaceNames.Add(iFaceNS);
                // Urt namespace will not have schema, they need to be recorded.
                URTNamespace parsingNamespace = parser.AddNewNamespace(iFaceNS);
                /*
                if (parsingNamespace == null)
                {
                    parsingNamespace = new URTNamespace(iFaceNS, parser);
                }
                */

                URTInterface parsingInterface = parsingNamespace.LookupInterface(iFaceName);            
                if (parsingInterface == null)
                {
                    parsingInterface = new URTInterface(iFaceName, parsingNamespace.Name, parsingNamespace.Namespace, parsingNamespace.EncodedNS, _parser);                    
                    parsingNamespace.AddInterface(parsingInterface);
                }
            }
コード例 #5
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            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;
                    }
                }

            }
コード例 #6
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 internal URTSimpleType(String name, String urlNS, String ns, String encodedNS, bool bAnonymous, WsdlParser parser)
 : base(name, urlNS, ns, encodedNS)
 {
     Util.Log("URTSimpleType.URTSimpleType name "+name+" ns "+ns+" encodedNS "+encodedNS+" bAnonymous "+bAnonymous);
     _baseTypeName = null;
     _baseTypeXmlNS = null;
     _baseType = null;
     _fieldString = null;
     _facets = new ArrayList();
     _bEnum = false;
     _bAnonymous = bAnonymous;
     _encoding = null;
     _parser = parser;
 }
コード例 #7
0
 // Main parser
 internal SUDSParser(TextReader input, String outputDir, ArrayList outCodeStreamList, String locationURL, bool bWrappedProxy, String proxyNamespace)
 {
     Util.Log("SUDSParser.SUDSParser outputDir " + outputDir + " locationURL " + locationURL + " bWrappedProxy " + bWrappedProxy + " proxyNamespace " + proxyNamespace);
     Util.LogInput(ref input);
     wsdlParser = new WsdlParser(input, outputDir, outCodeStreamList, locationURL, bWrappedProxy, proxyNamespace);
 }
コード例 #8
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            // Resolve element references
            internal void ResolveElements(WsdlParser parser){
                Util.Log("URTNamespace.ResolveElements "+Name);

                for (int i=0;i<_elmDecls.Count;i++)
                {
                    ((ElementDecl) _elmDecls[i]).Resolve(parser);
                }
            }
コード例 #9
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal void ResolveTypes(WsdlParser parser)
            {
                Util.Log("URTInterface.ResolveTypes "+Name);                
                for (int i=0;i<_baseIFaceNames.Count;i=i+2)
                {
                    String baseIFaceName = (String) _baseIFaceNames[i];
                    String baseIFaceXmlNS = (String) _baseIFaceNames[i+1];
                    String baseIFaceNS, baseIFaceAssemName;
                    BaseInterface iFace;
                    UrtType iType = parser.IsURTExportedType(baseIFaceXmlNS, out baseIFaceNS,
                                                             out baseIFaceAssemName);

                    Util.Log("URTInterface.ResolveTypes Is System "+Name+" iType "+((Enum)iType).ToString()+" baseIFaceNS "+baseIFaceNS);                                   
                    if ((iType != UrtType.Interop) && baseIFaceNS.StartsWith("System", StringComparison.Ordinal))
                    {
                        iFace = new SystemInterface(baseIFaceName, baseIFaceXmlNS, baseIFaceNS, _parser, baseIFaceAssemName);
                    }
                    else
                    {
                        URTNamespace ns = parser.LookupNamespace(baseIFaceXmlNS);
                        if (ns == null)
                        {
                            throw new SUDSParserException(
                                                         String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveSchemaNS"),
                                                                       baseIFaceXmlNS, baseIFaceName));
                        }
                        iFace = ns.LookupInterface(baseIFaceName);
                        if (iFace == null)
                        {
                            throw new SUDSParserException(
                                                         String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_CantResolveTypeInNS"),
                                                                       baseIFaceName, baseIFaceXmlNS));
                        }
                    }
                    _baseIFaces.Add(iFace);
                }
                for (int i=0;i<_methods.Count;i++)
                    ((URTMethod) _methods[i]).ResolveTypes(parser);
            }
コード例 #10
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal void Extends(String baseName, String baseNS, WsdlParser parser)
            {
                Util.Log("URTInterface.Extends baseName "+baseName+" baseNSf "+baseNS);
                _baseIFaceNames.Add(baseName);
                _baseIFaceNames.Add(baseNS);
                // Urt namespace will not have schema, they need to be recorded.
                URTNamespace parsingNamespace = parser.AddNewNamespace(baseNS);
                /*
                if (parsingNamespace == null)
                {
                    parsingNamespace = new URTNamespace(baseNS, parser);
                }
                */

                URTInterface parsingInterface = parsingNamespace.LookupInterface(baseName);         
                if (parsingInterface == null)
                {
                    parsingInterface = new URTInterface(baseName, parsingNamespace.Name, parsingNamespace.Namespace, parsingNamespace.EncodedNS, parser);                  
                    parsingNamespace.AddInterface(parsingInterface);
                }
                _extendsInterface.Add(parsingInterface);
            }
コード例 #11
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 internal URTInterface(String name, String urlNS, String ns, String encodedNS, WsdlParser parser)
 : base(name, urlNS, ns, encodedNS, parser)
 {
     Util.Log("URTInterface.URTInterface name "+name+" ns "+ns+" encodedNS "+encodedNS);                                             
     _baseIFaces = new ArrayList();
     _baseIFaceNames = new ArrayList();
     _extendsInterface = new ArrayList();
     _methods = new ArrayList();
     _parser = parser;
 }
コード例 #12
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal SystemInterface(String name, String urlNS, String ns, WsdlParser parser, String assemName)
            : base(name, urlNS, ns, ns, parser)
            {
                Util.Log("SystemInterface.SystemInterface");                
                Debug.Assert(ns.StartsWith("System", StringComparison.Ordinal), "Invalid System type");
                String fullName = ns + '.' + name;

                Assembly assem = null;
                if (assemName == null)
                    assem = typeof(string).Assembly;
                else
#pragma warning disable 618
                    assem = Assembly.LoadWithPartialName(assemName, null);
#pragma warning restore 618

                if (assem == null)
                    throw new SUDSParserException(String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_AssemblyNotFound"), assemName));

                _type = assem.GetType(fullName, true);
            }
コード例 #13
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 internal BaseInterface(String name, String urlNS, String ns, String encodedNS, WsdlParser parser)
 {
     Util.Log("BaseInterface.BaseInterface");
     _name = name;
     _urlNS = urlNS;
     _namespace = ns;
     _encodedNS = encodedNS;
     _parser = parser;
 }
コード例 #14
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            // Resolves the method
            internal override void ResolveTypes(WsdlParser parser)
            {
                Util.Log("OnewayMethod.ResolveTypes name "+ _messageElementName);
                ResolveWsdlParams(parser, _messageElementNS, _messageElementName, true, _wsdlMethodInfo);
                if (_paramNamesOrder != null)
                {
                    // reorder parameters if there is a parameter order
                    Object[] paramsInOrder = new Object[_params.Count];
                    for (int i=0; i<_params.Count; i++)
                    {
                        paramsInOrder[(int)_paramPosition[i]] = _params[i];
                    }
                    _params =  new ArrayList(paramsInOrder);
                }

                ResolveMethodAttributes(); //Needs to be after param order

                return;
            }
コード例 #15
0
 internal SUDSParser(TextReader input, string outputDir, ArrayList outCodeStreamList, string locationURL, bool bWrappedProxy, string proxyNamespace)
 {
     this.wsdlParser = new WsdlParser(input, outputDir, outCodeStreamList, locationURL, bWrappedProxy, proxyNamespace);
 }
コード例 #16
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 // Constructor
 internal URTNamespace(String name, WsdlParser parser)
 {
     Util.Log("URTNamespace.URTNamespace Enter name "+name);
     _name = name;
     _parser = parser;
     _nsType = parser.IsURTExportedType(name, out _namespace, out _assemName);
     if (_nsType == UrtType.Interop)
     {
         _encodedNS = EncodeInterop(_namespace, parser);
     }
     else
         _encodedNS = _namespace;
     _elmDecls = new ArrayList();
     _URTComplexTypes = new ArrayList();
     _numURTComplexTypes = 0;
     _URTSimpleTypes = new ArrayList();
     _numURTSimpleTypes = 0;
     _URTInterfaces = new ArrayList();
     _anonymousSeqNum = 0;
     parser.AddNamespace(this);
     Util.Log("URTNamespace.URTNamespace Exit name "+this.GetHashCode()+" "+name+" _namespace "+_namespace+" _assemName "+_assemName+" _encodedNS "+_encodedNS);
 }
コード例 #17
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 internal static String EncodeInterop(String name, WsdlParser parser)
 {
     String _encodedNS = name;
     if ((parser.ProxyNamespace != null) && parser.ProxyNamespace.Length > 0)
     {
         String countStr = "";
         if (parser.ProxyNamespaceCount > 0)
             countStr = (parser.ProxyNamespaceCount).ToString(CultureInfo.InvariantCulture);
         parser.ProxyNamespaceCount++;
         _encodedNS = parser.ProxyNamespace+countStr;
     }
     else
     {
         int index = name.IndexOf(":");
         if (index > 0)
             _encodedNS = _encodedNS.Substring(index+1);
         if (_encodedNS.StartsWith("//", StringComparison.Ordinal))
             _encodedNS = _encodedNS.Substring(2);
         _encodedNS = _encodedNS.Replace('/', '_');
     }
     Util.Log("URTNamespace.EncodeInterop  encoded "+_encodedNS);
     return _encodedNS;
 }
コード例 #18
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            internal URTField(String name, String typeName, String xmlNS, WsdlParser parser,
                              bool bPrimitive, bool bEmbedded, bool bAttribute, bool bOptional,
                              bool bArray, String arraySize, URTNamespace urtNamespace)
            {
                Util.Log("URTField.URTField "+name+" typeName "+typeName+" xmlNS "+xmlNS+" bPrimitive "+bPrimitive+" bEmbedded "+bEmbedded+" bAttribute "+bAttribute);
                _name = name;
                _typeName = typeName;
                _parser = parser;
                String typeAssemName;

                UrtType urtType = parser.IsURTExportedType(xmlNS, out _typeNS, out typeAssemName);
                if (urtType == UrtType.Interop)
                    _encodedNS = urtNamespace.EncodedNS;
                else
                    _encodedNS = _typeNS;
                _primitiveField = bPrimitive;
                _embeddedField = bEmbedded;
                _attributeField = bAttribute;
                _optionalField = bOptional;
                _arrayField = bArray;
                _arraySize = arraySize;
                _urtNamespace = urtNamespace;
            }
コード例 #19
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
            // Resolves internal references
            internal void ResolveTypes(WsdlParser parser){
                Util.Log("URTNamespace.ResolveTypes "+Name); 

                /*
                // Process nested types 
                Hashtable typeTable = new Hashtable(10);
                for (int i=0;i<_URTComplexTypes.Count;i++)
                {
                    // fill up hashtable with types
                    URTComplexType ctype = (URTComplexType)_URTComplexTypes[i];

                    if (ctype.bNestedType)
                    {
                        Util.Log("URTNamespace.ResolveTypes nested type outer type "+ctype.OuterTypeName+" nested type "+ctype.NestedTypeName+" fullNestedTypeName "+ctype.Name);
                        // type is a nested class 
                        URTComplexType outerType = (URTComplexType)typeTable[ctype.OuterTypeName];
                        if (outerType == null)
                        {
                            // place all the URTComplex types in the table, the nested type appears before the outer type in Wsdl
                            for (int j=0;j<_URTComplexTypes.Count;j++)
                            {
                                URTComplexType ctype2 = (URTComplexType)_URTComplexTypes[j];
                                Util.Log("URTNamespace.ResolveTypes miss find all types "+ctype2.Name);
                                typeTable[ctype2.Name] = ctype2;
                            }
                        }
                        outerType = (URTComplexType)typeTable[ctype.OuterTypeName];
                        if (outerType == null)
                        {
                            throw new SUDSParserException(
                                                 String.Format(CoreChannel.GetResourceString("Remoting_Suds_CantResolveNestedType"),
                                                               ctype.Name, ctype.UrlNS));
                        }
                        outerType._nestedTypes.Add(ctype);

                    }
                    else
                    {

                        Util.Log("URTNamespace.ResolveTypes nested place in table "+ctype.Name);
                        typeTable[ctype.Name] = ctype;
                    }
                }
                */


                for (int i=0;i<_URTComplexTypes.Count;i++)
                {
                    if (_URTComplexTypes[i] != null)
                        ((URTComplexType)_URTComplexTypes[i]).ResolveTypes(parser);
                }

                for (int i=0;i<_URTInterfaces.Count;i++)
                    ((URTInterface)_URTInterfaces[i]).ResolveTypes(parser);
            }
コード例 #20
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 internal virtual void ResolveTypes(WsdlParser parser)
 {
 }