コード例 #1
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
        private WsdlBindingOperationSection ParseWsdlBindingOperationSection(WsdlBindingOperation op, String inputElementName, ref bool bSoapEncoded)
        {
            Util.Log("WsdlParser.ParseWsdlBindingOperationSections");
            bool breturn = false;
            WsdlBindingOperationSection opSec = new WsdlBindingOperationSection();
            op.sections.Add(opSec);
            opSec.name = LookupAttribute(s_nameString, null, false);
            if (MatchingStrings(opSec.name, s_emptyString))
            {
                if (MatchingStrings(inputElementName, s_inputString))
                {
                    breturn = true;
                    opSec.name = Atomize(op.name+"Request");
                }
                else if (MatchingStrings(inputElementName, s_outputString))
                    opSec.name = Atomize(op.name+"Response");
            }
            opSec.elementName = inputElementName;
            int curDepth = _XMLReader.Depth; 
            ReadNextXmlElement();               
            while (_XMLReader.Depth > curDepth)
            {
                String elementName = _XMLReader.LocalName;
                if (MatchingNamespace(s_wsdlSoapNamespaceString))
                {
                    if (MatchingStrings(elementName, s_bodyString))
                    {
                        WsdlBindingSoapBody soapBody = new WsdlBindingSoapBody();
                        opSec.extensions.Add(soapBody);
                        soapBody.parts = LookupAttribute(s_partsString, null, false);
                        soapBody.use = LookupAttribute(s_useString, null, true); 
                        if (soapBody.use == "encoded")
                            bSoapEncoded = true;
                        soapBody.encodingStyle = LookupAttribute(s_encodingStyleString, null, false);
                        soapBody.namespaceUri = LookupAttribute(s_namespaceString, null, false);
                        ReadNextXmlElement();
                        continue;                       
                    }
                    else if (MatchingStrings(elementName, s_headerString))
                    {
                        WsdlBindingSoapHeader soapHeader = new WsdlBindingSoapHeader();
                        opSec.extensions.Add(soapHeader);
                        soapHeader.message = LookupAttribute(s_messageString, null, true);  
                        soapHeader.messageNs = ParseQName(ref soapHeader.message);
                        soapHeader.part = LookupAttribute(s_partString, null, true);
                        soapHeader.use = LookupAttribute(s_useString, null, true);
                        soapHeader.encodingStyle = LookupAttribute(s_encodingStyleString, null, false);
                        soapHeader.namespaceUri = LookupAttribute(s_namespaceString, null, false);
                        ReadNextXmlElement();
                        continue;                       
                    }
                    else if (MatchingStrings(elementName, s_faultString))
                    {
                        WsdlBindingSoapFault soapFault = new WsdlBindingSoapFault();
                        opSec.extensions.Add(soapFault);
                        soapFault.name = LookupAttribute(s_nameString, null, true);  
                        soapFault.use = LookupAttribute(s_useString, null, true);
                        soapFault.encodingStyle = LookupAttribute(s_encodingStyleString, null, false);
                        soapFault.namespaceUri = LookupAttribute(s_namespaceString, null, false);
                        ReadNextXmlElement();
                        continue;                       
                    }

                }
                // Ignore others elements such as annotations
                // headerFault currently ignored
                SkipXmlElement();
            }

            // returning opSec only if a fixup might be necessary, this is the case of an input section with an empty input name
            // it will be fixed up later if there is no output section
            if (breturn)
                return opSec;
            else
                return null;
        }
コード例 #2
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
        private void ParseWsdlBindingOperation(WsdlBindingOperation op, ref bool bRpcBinding, ref bool bSoapEncoded)
        {
            Util.Log("WsdlParser.ParseWsdlBindingOperation");                                                                                   
            int curDepth = _XMLReader.Depth; 
            bool binput = false;
            bool boutput = false;
            WsdlBindingOperationSection opSec = null;

            ReadNextXmlElement();               

            while (_XMLReader.Depth > curDepth)
            {
                String elementName = _XMLReader.LocalName;

                if (MatchingNamespace(s_wsdlSudsNamespaceString) && MatchingStrings(elementName, s_methodString))
                {
                    op.methodAttributes = LookupAttribute(s_attributesString, null, true);
                    ReadNextXmlElement();                                   
                    continue;                                       
                }
                else if (MatchingNamespace(s_wsdlSoapNamespaceString) &&
                         MatchingStrings(elementName, s_operationString))
                {
                    WsdlBindingSoapOperation soapOp = new WsdlBindingSoapOperation();
                    soapOp.soapAction = LookupAttribute(s_soapActionString, null, false);
                    soapOp.style = LookupAttribute(s_styleString, null, false);
                    if (soapOp.style == "rpc")
                        bRpcBinding = true;
                    {
                    }
                    op.soapOperation = soapOp;
                    ReadNextXmlElement();                                   
                    continue;                   
                }
                else if (MatchingNamespace(s_wsdlNamespaceString))
                {
                    if (MatchingStrings(elementName, s_inputString))
                    {
                        binput = true;
                        opSec = ParseWsdlBindingOperationSection(op, elementName, ref bSoapEncoded);
                        continue;                       
                    }
                    else if (MatchingStrings(elementName, s_outputString))
                    {
                        boutput = true;
                        ParseWsdlBindingOperationSection(op, elementName, ref bSoapEncoded);
                        continue;                       
                    }
                    else if (MatchingStrings(elementName, s_faultString))
                    {
                        ParseWsdlBindingOperationSection(op, elementName, ref bSoapEncoded);
                        continue;                       
                    }
                }

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

            // if no output section then the default name is just the op name.
            if (opSec != null && binput && !boutput)
                opSec.name = op.name;


        }
コード例 #3
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
        private void ParseWsdlBinding(URTNamespace inparsingNamespace)
        {
            Util.Log("WsdlParser.ParseWsdlBinding");
            WsdlBinding binding = new WsdlBinding();
            binding.name = LookupAttribute(s_nameString, null, true);
            //binding.nameNs = ParseQName(ref binding.name);
            binding.type = LookupAttribute(s_typeString, null, true);
            binding.typeNs = ParseQName(ref binding.type);
            URTNamespace parsingNamespace = LookupNamespace(binding.typeNs);
            if (parsingNamespace == null)
            {
                parsingNamespace = new URTNamespace(binding.typeNs, this); 
            }
            binding.parsingNamespace = parsingNamespace;
            bool bSoapBinding = false;
            bool bRpcBinding = false;
            bool bSoapEncoded = false;
            bool bSoapSuds = false;
            int curDepth = _XMLReader.Depth; 
            ReadNextXmlElement();               
            while (_XMLReader.Depth > curDepth)
            {
                String elementName = _XMLReader.LocalName;
                if (MatchingNamespace(s_wsdlSoapNamespaceString) &&
                    MatchingStrings(elementName, s_bindingString))
                {
                    bSoapBinding = true;
                    WsdlBindingSoapBinding sb = new WsdlBindingSoapBinding();
                    sb.style = LookupAttribute(s_styleString, null, true);
                    if (sb.style == "rpc")
                        bRpcBinding = true;

                    /*
                    if (sb.style == "document")
                    {
                        throw new SUDSParserException(
                            String.Format(CoreChannel.GetResourceString("Remoting_Suds_SoapStyleNotSupported"),
                                          sb.style));
                    }
                    */

                    sb.transport = LookupAttribute(s_transportString, null, true);
                    binding.soapBinding = sb;
                    ReadNextXmlElement();
                    continue;                   
                }
                else if (MatchingNamespace(s_wsdlSudsNamespaceString))
                {
                    bSoapSuds = true;
                    if (MatchingStrings(elementName, s_classString) || MatchingStrings(elementName, s_structString))
                    {
                        WsdlBindingSuds suds = new WsdlBindingSuds();
                        suds.elementName = elementName;
                        suds.typeName = LookupAttribute(s_typeString, null, true);
                        suds.ns = ParseQName(ref suds.typeName);
                        suds.extendsTypeName = LookupAttribute(s_extendsString, null, false);
                        String use = LookupAttribute(s_rootTypeString, null, false);
                        suds.sudsUse = ProcessSudsUse(use, elementName);
                        if (!MatchingStrings(suds.extendsTypeName, s_emptyString))
                            suds.extendsNs = ParseQName(ref suds.extendsTypeName);
                        ParseWsdlBindingSuds(suds);
                        binding.suds.Add(suds);
                        continue;                       
                    }
                    else if (MatchingStrings(elementName, s_interfaceString))
                    {
                        WsdlBindingSuds suds = new WsdlBindingSuds();                       
                        suds.elementName = elementName; //Atomize("interface");
                        suds.typeName = LookupAttribute(s_typeString, null, true);
                        suds.ns = ParseQName(ref suds.typeName);        
                        String use = LookupAttribute(s_rootTypeString, null, false);
                        suds.sudsUse = ProcessSudsUse(use, elementName);
                        ParseWsdlBindingSuds(suds);
                        binding.suds.Add(suds);
                        continue;                       
                    }
                }
                else if (MatchingNamespace(s_wsdlNamespaceString) &&
                         MatchingStrings(elementName, s_operationString))
                {
                    WsdlBindingOperation op = new WsdlBindingOperation();
                    op.name = LookupAttribute(s_nameString, null, true); 
                    op.nameNs = _parsingInput.TargetNS;
                    ParseWsdlBindingOperation(op, ref bRpcBinding, ref bSoapEncoded);
                    binding.operations.Add(op);
                    continue;                   
                }

                // Ignore others elements such as annotations
                SkipXmlElement();
            }
            if (bSoapBinding && bRpcBinding && bSoapEncoded || bSoapSuds)
                wsdlBindings.Add(binding);
        }
コード例 #4
0
 private WsdlBindingOperationSection ParseWsdlBindingOperationSection(WsdlBindingOperation op, string inputElementName, ref bool bSoapEncoded)
 {
     bool flag = false;
     WsdlBindingOperationSection section = new WsdlBindingOperationSection();
     op.sections.Add(section);
     section.name = this.LookupAttribute(s_nameString, null, false);
     if (MatchingStrings(section.name, s_emptyString))
     {
         if (MatchingStrings(inputElementName, s_inputString))
         {
             flag = true;
             section.name = this.Atomize(op.name + "Request");
         }
         else if (MatchingStrings(inputElementName, s_outputString))
         {
             section.name = this.Atomize(op.name + "Response");
         }
     }
     section.elementName = inputElementName;
     int depth = this._XMLReader.Depth;
     this.ReadNextXmlElement();
     while (this._XMLReader.Depth > depth)
     {
         string localName = this._XMLReader.LocalName;
         if (this.MatchingNamespace(s_wsdlSoapNamespaceString))
         {
             if (MatchingStrings(localName, s_bodyString))
             {
                 WsdlBindingSoapBody body = new WsdlBindingSoapBody();
                 section.extensions.Add(body);
                 body.parts = this.LookupAttribute(s_partsString, null, false);
                 body.use = this.LookupAttribute(s_useString, null, true);
                 if (body.use == "encoded")
                 {
                     bSoapEncoded = true;
                 }
                 body.encodingStyle = this.LookupAttribute(s_encodingStyleString, null, false);
                 body.namespaceUri = this.LookupAttribute(s_namespaceString, null, false);
                 this.ReadNextXmlElement();
                 continue;
             }
             if (MatchingStrings(localName, s_headerString))
             {
                 WsdlBindingSoapHeader header = new WsdlBindingSoapHeader();
                 section.extensions.Add(header);
                 header.message = this.LookupAttribute(s_messageString, null, true);
                 header.messageNs = this.ParseQName(ref header.message);
                 header.part = this.LookupAttribute(s_partString, null, true);
                 header.use = this.LookupAttribute(s_useString, null, true);
                 header.encodingStyle = this.LookupAttribute(s_encodingStyleString, null, false);
                 header.namespaceUri = this.LookupAttribute(s_namespaceString, null, false);
                 this.ReadNextXmlElement();
                 continue;
             }
             if (MatchingStrings(localName, s_faultString))
             {
                 WsdlBindingSoapFault fault = new WsdlBindingSoapFault();
                 section.extensions.Add(fault);
                 fault.name = this.LookupAttribute(s_nameString, null, true);
                 fault.use = this.LookupAttribute(s_useString, null, true);
                 fault.encodingStyle = this.LookupAttribute(s_encodingStyleString, null, false);
                 fault.namespaceUri = this.LookupAttribute(s_namespaceString, null, false);
                 this.ReadNextXmlElement();
                 continue;
             }
         }
         this.SkipXmlElement();
     }
     if (flag)
     {
         return section;
     }
     return null;
 }
コード例 #5
0
 private void ParseWsdlBindingOperation(WsdlBindingOperation op, ref bool bRpcBinding, ref bool bSoapEncoded)
 {
     int depth = this._XMLReader.Depth;
     bool flag = false;
     bool flag2 = false;
     WsdlBindingOperationSection section = null;
     this.ReadNextXmlElement();
     while (this._XMLReader.Depth > depth)
     {
         string localName = this._XMLReader.LocalName;
         if (this.MatchingNamespace(s_wsdlSudsNamespaceString) && MatchingStrings(localName, s_methodString))
         {
             op.methodAttributes = this.LookupAttribute(s_attributesString, null, true);
             this.ReadNextXmlElement();
         }
         else
         {
             if (this.MatchingNamespace(s_wsdlSoapNamespaceString) && MatchingStrings(localName, s_operationString))
             {
                 WsdlBindingSoapOperation operation = new WsdlBindingSoapOperation {
                     soapAction = this.LookupAttribute(s_soapActionString, null, false),
                     style = this.LookupAttribute(s_styleString, null, false)
                 };
                 if (operation.style == "rpc")
                 {
                     bRpcBinding = true;
                 }
                 op.soapOperation = operation;
                 this.ReadNextXmlElement();
                 continue;
             }
             if (this.MatchingNamespace(s_wsdlNamespaceString))
             {
                 if (MatchingStrings(localName, s_inputString))
                 {
                     flag = true;
                     section = this.ParseWsdlBindingOperationSection(op, localName, ref bSoapEncoded);
                     continue;
                 }
                 if (MatchingStrings(localName, s_outputString))
                 {
                     flag2 = true;
                     this.ParseWsdlBindingOperationSection(op, localName, ref bSoapEncoded);
                     continue;
                 }
                 if (MatchingStrings(localName, s_faultString))
                 {
                     this.ParseWsdlBindingOperationSection(op, localName, ref bSoapEncoded);
                     continue;
                 }
             }
             this.SkipXmlElement();
         }
     }
     if (((section != null) && flag) && !flag2)
     {
         section.name = op.name;
     }
 }
コード例 #6
0
 private void ParseWsdlBinding(URTNamespace inparsingNamespace)
 {
     WsdlBinding binding;
     binding = new WsdlBinding {
         name = this.LookupAttribute(s_nameString, null, true),
         type = this.LookupAttribute(s_typeString, null, true),
         typeNs = this.ParseQName(ref binding.type)
     };
     URTNamespace namespace2 = this.LookupNamespace(binding.typeNs);
     if (namespace2 == null)
     {
         namespace2 = new URTNamespace(binding.typeNs, this);
     }
     binding.parsingNamespace = namespace2;
     bool flag = false;
     bool bRpcBinding = false;
     bool bSoapEncoded = false;
     bool flag4 = false;
     int depth = this._XMLReader.Depth;
     this.ReadNextXmlElement();
     while (this._XMLReader.Depth > depth)
     {
         string localName = this._XMLReader.LocalName;
         if (this.MatchingNamespace(s_wsdlSoapNamespaceString) && MatchingStrings(localName, s_bindingString))
         {
             flag = true;
             WsdlBindingSoapBinding binding2 = new WsdlBindingSoapBinding {
                 style = this.LookupAttribute(s_styleString, null, true)
             };
             if (binding2.style == "rpc")
             {
                 bRpcBinding = true;
             }
             binding2.transport = this.LookupAttribute(s_transportString, null, true);
             binding.soapBinding = binding2;
             this.ReadNextXmlElement();
             continue;
         }
         if (this.MatchingNamespace(s_wsdlSudsNamespaceString))
         {
             flag4 = true;
             if (MatchingStrings(localName, s_classString) || MatchingStrings(localName, s_structString))
             {
                 WsdlBindingSuds suds;
                 suds = new WsdlBindingSuds {
                     elementName = localName,
                     typeName = this.LookupAttribute(s_typeString, null, true),
                     ns = this.ParseQName(ref suds.typeName),
                     extendsTypeName = this.LookupAttribute(s_extendsString, null, false)
                 };
                 string use = this.LookupAttribute(s_rootTypeString, null, false);
                 suds.sudsUse = this.ProcessSudsUse(use, localName);
                 if (!MatchingStrings(suds.extendsTypeName, s_emptyString))
                 {
                     suds.extendsNs = this.ParseQName(ref suds.extendsTypeName);
                 }
                 this.ParseWsdlBindingSuds(suds);
                 binding.suds.Add(suds);
             }
             else
             {
                 WsdlBindingSuds suds2;
                 if (!MatchingStrings(localName, s_interfaceString))
                 {
                     goto Label_02CC;
                 }
                 suds2 = new WsdlBindingSuds {
                     elementName = localName,
                     typeName = this.LookupAttribute(s_typeString, null, true),
                     ns = this.ParseQName(ref suds2.typeName)
                 };
                 string str3 = this.LookupAttribute(s_rootTypeString, null, false);
                 suds2.sudsUse = this.ProcessSudsUse(str3, localName);
                 this.ParseWsdlBindingSuds(suds2);
                 binding.suds.Add(suds2);
             }
             continue;
         }
         if (this.MatchingNamespace(s_wsdlNamespaceString) && MatchingStrings(localName, s_operationString))
         {
             WsdlBindingOperation op = new WsdlBindingOperation {
                 name = this.LookupAttribute(s_nameString, null, true),
                 nameNs = this._parsingInput.TargetNS
             };
             this.ParseWsdlBindingOperation(op, ref bRpcBinding, ref bSoapEncoded);
             binding.operations.Add(op);
             continue;
         }
     Label_02CC:
         this.SkipXmlElement();
     }
     if (((flag && bRpcBinding) && bSoapEncoded) || flag4)
     {
         this.wsdlBindings.Add(binding);
     }
 }