예제 #1
0
파일: WsdlParser.cs 프로젝트: JianwenSun/cc
        private void ResolveWsdlInterface(WsdlBinding binding, WsdlBindingSuds suds)
        {
            Util.Log("WsdlParser.ResolveWsdlInterface "+binding.name+" ns "+binding.parsingNamespace.Namespace+" suds "+suds.typeName);

            URTNamespace parsingNamespace = binding.parsingNamespace;

            URTNamespace sudsNamespace = AddNewNamespace(suds.ns);
            /*
            if (sudsNamespace == null)
            {
                sudsNamespace = new URTNamespace(suds.ns, this);
            }
            */

            URTInterface parsingInterface = sudsNamespace.LookupInterface(suds.typeName);           
            if (parsingInterface == null)
            {
                parsingInterface = new URTInterface(suds.typeName, sudsNamespace.Name, sudsNamespace.Namespace, sudsNamespace.EncodedNS, this);
                sudsNamespace.AddInterface(parsingInterface);
            }

            if (suds.extendsTypeName != null)
            {
                parsingInterface.Extends(suds.extendsTypeName, suds.extendsNs, this);
            }
            foreach (WsdlBindingSudsImplements impl in suds.implements)
            {
                parsingInterface.Extends(impl.typeName, impl.ns, this);             
            }

            ArrayList methodInfos = ResolveWsdlMethodInfo(binding);

            foreach (WsdlMethodInfo methodInfo in methodInfos)          
            {
                if ((methodInfo.inputMethodName != null) && (methodInfo.outputMethodName != null))
                {
                    RRMethod parsingRRMethod = new RRMethod(methodInfo, null);
                    parsingRRMethod.AddRequest(methodInfo.methodName, methodInfo.methodNameNs);
                    parsingRRMethod.AddResponse(methodInfo.methodName, methodInfo.methodNameNs);
                    parsingInterface.AddMethod(parsingRRMethod);
                }
                else if (methodInfo.inputMethodName != null)
                {
                    OnewayMethod parsingOWMethod = new OnewayMethod(methodInfo.methodName, methodInfo.soapAction, null);
                    parsingOWMethod.AddMessage(methodInfo.methodName, methodInfo.methodNameNs);                 
                    parsingInterface.AddMethod(parsingOWMethod);
                }
                else
                {
                    throw new SUDSParserException(
                                                 String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidMessage"),
                                                               methodInfo.methodName));

                }
            }
        }
예제 #2
0
파일: WsdlParser.cs 프로젝트: JianwenSun/cc
        private void ResolveWsdlClass(WsdlBinding binding, WsdlBindingSuds suds, bool bFirstSuds)
        {
            // bFirstSuds is true then the suds class is the class for the binding. 
            // The other suds are additional class without bindings in the same namespace.
            Util.Log("WsdlParser.ResolveWsdlClass suds "+suds);
            URTComplexType parsingComplexType;
            //URTNamespace parsingNamespace = binding.parsingNamespace;
            URTNamespace parsingNamespace;
            //URTNamespace parsingNamespace = binding.typeNs;

            if (suds != null)
            {
                Util.Log("WsdlParser.ResolveWsdlClass suds not null "+suds.elementName+" "+suds.typeName);
                // Suds
                parsingNamespace = AddNewNamespace(suds.ns);
                parsingComplexType = parsingNamespace.LookupComplexType(suds.typeName);
                if (parsingComplexType == null)
                {
                    parsingComplexType = new URTComplexType(suds.typeName, parsingNamespace.Name, parsingNamespace.Namespace, parsingNamespace.EncodedNS, _blockDefault ,false, false, this, parsingNamespace);
                    parsingNamespace.AddComplexType(parsingComplexType);
                }

                if (MatchingStrings(suds.elementName, s_structString))
                    parsingComplexType.IsValueType = true;

                parsingComplexType.SudsUse = suds.sudsUse;

                if (suds.sudsUse == SudsUse.MarshalByRef || 
                    suds.sudsUse == SudsUse.ServicedComponent
                   )
                {
                    Util.Log("WsdlParser.ResolveWsdlClass MarshalByRef IsSudsType true 1 "+suds.elementName+" "+suds.typeName);
                    parsingComplexType.IsSUDSType = true; 

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


                    if ((suds.extendsTypeName != null) && (suds.extendsTypeName.Length > 0))
                    {
                        URTNamespace extendsNamespace = AddNewNamespace(suds.extendsNs);                    
                        /*
                        if (extendsNamespace == null)
                            extendsNamespace = new URTNamespace(suds.extendsTypeName, this);
                            */

                        URTComplexType extendsComplexType = extendsNamespace.LookupComplexType(suds.extendsTypeName);                   
                        if (extendsComplexType == null)
                        {
                            extendsComplexType = new URTComplexType(suds.extendsTypeName, extendsNamespace.Name, extendsNamespace.Namespace, extendsNamespace.EncodedNS, _blockDefault ,true, false, this, extendsNamespace);
                            extendsNamespace.AddComplexType(extendsComplexType);
                        }
                        else
                        {
                            Util.Log("WsdlParser.ResolveWsdlClass IsSudsType true 2 "+suds.elementName+" "+suds.typeName);
                            extendsComplexType.IsSUDSType = true;
                        }

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

                        extendsComplexType.SudsUse = suds.sudsUse;

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

                foreach (WsdlBindingSudsNestedType nestedType in suds.nestedTypes)
                {
                    ResolveWsdlNestedType(binding, suds, nestedType);
                }
            }
            else
            {
                // No suds
                Util.Log("WsdlParser.ResolveWsdlClass no suds ");
                parsingNamespace = AddNewNamespace(binding.typeNs);
                String name = binding.name;
                int index = binding.name.IndexOf("Binding");
                if (index > 0)
                {
                    //name = Atomize(binding.name.Substring(0,index));
                    name = binding.name.Substring(0,index);
                }

                parsingComplexType = parsingNamespace.LookupComplexTypeEqual(name);
                if (parsingComplexType == null)
                {
                    parsingComplexType = new URTComplexType(name, parsingNamespace.Name, parsingNamespace.Namespace, parsingNamespace.EncodedNS, _blockDefault ,true, false, this, parsingNamespace);
                    parsingNamespace.AddComplexType(parsingComplexType);                    
                }
                else
                {
                    Util.Log("WsdlParser.ResolveWsdlClass IsSudsType true 3 "+name);
                    parsingComplexType.IsSUDSType = true;
                }
                if (_bWrappedProxy)
                    parsingComplexType.SUDSType = SUDSType.ClientProxy;
                else
                    parsingComplexType.SUDSType = SUDSType.MarshalByRef;

                parsingComplexType.SudsUse = SudsUse.MarshalByRef;
            }

            // Resolve address
            parsingComplexType.ConnectURLs = ResolveWsdlAddress(binding);

            // Resolve extends and implements
            if (suds != null)
            {
                if (!MatchingStrings(suds.extendsTypeName, s_emptyString))
                {
                    parsingComplexType.Extends(suds.extendsTypeName, suds.extendsNs);
                }

                foreach (WsdlBindingSudsImplements impl in suds.implements)
                parsingComplexType.Implements(impl.typeName, impl.ns, this);  
            }




            if (bFirstSuds && 
                (parsingComplexType.SudsUse == SudsUse.MarshalByRef || 
                 parsingComplexType.SudsUse == SudsUse.ServicedComponent || 
                 parsingComplexType.SudsUse == SudsUse.Delegate || 
                 parsingComplexType.SudsUse == SudsUse.Interface))
            {
                // Resolve methods

                ArrayList methodInfos = ResolveWsdlMethodInfo(binding);

                foreach (WsdlMethodInfo methodInfo in methodInfos)
                {
                    if ((methodInfo.inputMethodName != null) && (methodInfo.outputMethodName != null))
                    {
                        RRMethod parsingRRMethod = new RRMethod(methodInfo, parsingComplexType);
                        parsingRRMethod.AddRequest(methodInfo.methodName, methodInfo.methodNameNs);
                        parsingRRMethod.AddResponse(methodInfo.methodName, methodInfo.methodNameNs);
                        parsingComplexType.AddMethod(parsingRRMethod);
                    }
                    else if (methodInfo.inputMethodName != null)
                    {
                        OnewayMethod parsingOWMethod = new OnewayMethod(methodInfo, parsingComplexType);
                        parsingComplexType.AddMethod(parsingOWMethod);
                        parsingOWMethod.AddMessage(methodInfo.methodName, methodInfo.methodNameNs);
                    }
                    else
                    {
                        throw new SUDSParserException(
                                                     String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidMessage"),
                                                                   methodInfo.methodName));
                    }
                }
            }
        }
 private void ResolveWsdlClass(WsdlBinding binding, WsdlBindingSuds suds, bool bFirstSuds)
 {
     URTComplexType complexType;
     URTNamespace namespace2;
     if (suds != null)
     {
         namespace2 = this.AddNewNamespace(suds.ns);
         complexType = namespace2.LookupComplexType(suds.typeName);
         if (complexType == null)
         {
             complexType = new URTComplexType(suds.typeName, namespace2.Name, namespace2.Namespace, namespace2.EncodedNS, this._blockDefault, false, false, this, namespace2);
             namespace2.AddComplexType(complexType);
         }
         if (MatchingStrings(suds.elementName, s_structString))
         {
             complexType.IsValueType = true;
         }
         complexType.SudsUse = suds.sudsUse;
         if ((suds.sudsUse == SudsUse.MarshalByRef) || (suds.sudsUse == SudsUse.ServicedComponent))
         {
             complexType.IsSUDSType = true;
             if (this._bWrappedProxy)
             {
                 complexType.SUDSType = SUDSType.ClientProxy;
             }
             else
             {
                 complexType.SUDSType = SUDSType.MarshalByRef;
             }
             if ((suds.extendsTypeName != null) && (suds.extendsTypeName.Length > 0))
             {
                 URTNamespace xns = this.AddNewNamespace(suds.extendsNs);
                 URTComplexType type = xns.LookupComplexType(suds.extendsTypeName);
                 if (type == null)
                 {
                     type = new URTComplexType(suds.extendsTypeName, xns.Name, xns.Namespace, xns.EncodedNS, this._blockDefault, true, false, this, xns);
                     xns.AddComplexType(type);
                 }
                 else
                 {
                     type.IsSUDSType = true;
                 }
                 if (this._bWrappedProxy)
                 {
                     type.SUDSType = SUDSType.ClientProxy;
                 }
                 else
                 {
                     type.SUDSType = SUDSType.MarshalByRef;
                 }
                 type.SudsUse = suds.sudsUse;
             }
         }
         foreach (WsdlBindingSudsNestedType type3 in suds.nestedTypes)
         {
             this.ResolveWsdlNestedType(binding, suds, type3);
         }
     }
     else
     {
         namespace2 = this.AddNewNamespace(binding.typeNs);
         string name = binding.name;
         int index = binding.name.IndexOf("Binding");
         if (index > 0)
         {
             name = binding.name.Substring(0, index);
         }
         complexType = namespace2.LookupComplexTypeEqual(name);
         if (complexType == null)
         {
             complexType = new URTComplexType(name, namespace2.Name, namespace2.Namespace, namespace2.EncodedNS, this._blockDefault, true, false, this, namespace2);
             namespace2.AddComplexType(complexType);
         }
         else
         {
             complexType.IsSUDSType = true;
         }
         if (this._bWrappedProxy)
         {
             complexType.SUDSType = SUDSType.ClientProxy;
         }
         else
         {
             complexType.SUDSType = SUDSType.MarshalByRef;
         }
         complexType.SudsUse = SudsUse.MarshalByRef;
     }
     complexType.ConnectURLs = this.ResolveWsdlAddress(binding);
     if (suds != null)
     {
         if (!MatchingStrings(suds.extendsTypeName, s_emptyString))
         {
             complexType.Extends(suds.extendsTypeName, suds.extendsNs);
         }
         foreach (WsdlBindingSudsImplements implements in suds.implements)
         {
             complexType.Implements(implements.typeName, implements.ns, this);
         }
     }
     if (bFirstSuds && (((complexType.SudsUse == SudsUse.MarshalByRef) || (complexType.SudsUse == SudsUse.ServicedComponent)) || ((complexType.SudsUse == SudsUse.Delegate) || (complexType.SudsUse == SudsUse.Interface))))
     {
         foreach (WsdlMethodInfo info in this.ResolveWsdlMethodInfo(binding))
         {
             if ((info.inputMethodName == null) || (info.outputMethodName == null))
             {
                 if (info.inputMethodName == null)
                 {
                     throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidMessage"), new object[] { info.methodName }));
                 }
                 OnewayMethod method2 = new OnewayMethod(info, complexType);
                 complexType.AddMethod(method2);
                 method2.AddMessage(info.methodName, info.methodNameNs);
             }
             else
             {
                 RRMethod method = new RRMethod(info, complexType);
                 method.AddRequest(info.methodName, info.methodNameNs);
                 method.AddResponse(info.methodName, info.methodNameNs);
                 complexType.AddMethod(method);
             }
         }
     }
 }
 private void ResolveWsdlInterface(WsdlBinding binding, WsdlBindingSuds suds)
 {
     URTNamespace parsingNamespace = binding.parsingNamespace;
     URTNamespace namespace2 = this.AddNewNamespace(suds.ns);
     URTInterface iface = namespace2.LookupInterface(suds.typeName);
     if (iface == null)
     {
         iface = new URTInterface(suds.typeName, namespace2.Name, namespace2.Namespace, namespace2.EncodedNS, this);
         namespace2.AddInterface(iface);
     }
     if (suds.extendsTypeName != null)
     {
         iface.Extends(suds.extendsTypeName, suds.extendsNs, this);
     }
     foreach (WsdlBindingSudsImplements implements in suds.implements)
     {
         iface.Extends(implements.typeName, implements.ns, this);
     }
     foreach (WsdlMethodInfo info in this.ResolveWsdlMethodInfo(binding))
     {
         if ((info.inputMethodName == null) || (info.outputMethodName == null))
         {
             if (info.inputMethodName == null)
             {
                 throw new SUDSParserException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_WsdlInvalidMessage"), new object[] { info.methodName }));
             }
             OnewayMethod method2 = new OnewayMethod(info.methodName, info.soapAction, null);
             method2.AddMessage(info.methodName, info.methodNameNs);
             iface.AddMethod(method2);
         }
         else
         {
             RRMethod method = new RRMethod(info, null);
             method.AddRequest(info.methodName, info.methodNameNs);
             method.AddResponse(info.methodName, info.methodNameNs);
             iface.AddMethod(method);
         }
     }
 }
예제 #5
0
        // Parses a oneway method
        private void ParseOnewayMethod(URTComplexType parsingComplexType, URTInterface parsingInterface)
        {
            Util.Log("SdlParser.ParseOnewayMethod");            
            String methodName = LookupAttribute(s_nameString, null, true);
            String soapAction = LookupAttribute(s_soapActionString, null, false);
            OnewayMethod parsingMethod = new OnewayMethod(methodName, soapAction);
            int curDepth = _XMLReader.Depth;
            ReadNextXmlElement();
            while(_XMLReader.Depth > curDepth)
            {
                if (MatchingNamespace(s_sudsNamespaceString))
                {
                    String elmName = _XMLReader.LocalName;
                    if(MatchingStrings(elmName, s_requestString))
                    {
                        String refValue = LookupAttribute(s_refString, null, true);
                        String refNS = ParseQName(ref refValue);
                        parsingMethod.AddMessage(refValue, refNS);
                        ReadNextXmlElement();
                        continue;
                    }
                }

                // Ignore others elements such as annotations
                SkipXmlElement();
            }
            if(parsingComplexType != null)
                parsingComplexType.AddMethod(parsingMethod);
            else
                parsingInterface.AddMethod(parsingMethod);

            return;
        }