コード例 #1
0
		public MessageDescription GetMessageDescription (
			OperationMessage operationMessage)
		{
			if (operationMessage == null)
				throw new ArgumentNullException ("operationMessage");
			var od = GetOperationDescription (operationMessage.Operation);
			if (od == null)
				throw new ArgumentException (String.Format ("Operation {0} for the argument OperationMessage was not found", operationMessage.Operation.Name));
			return od.Messages.FirstOrDefault (md => md.Direction == MessageDirection.Input && operationMessage is OperationInput || md.Direction == MessageDirection.Output && operationMessage is OperationOutput);
		}
コード例 #2
0
 string GetOperMessageName(OperationMessage msg, string operName)
 {
     if (msg.Name == null)
     {
         return(operName);
     }
     else
     {
         return(msg.Name);
     }
 }
コード例 #3
0
        public bool IsBoundBy(OperationBinding operationBinding)
        {
            if (operationBinding.Name != base.Name)
            {
                return(false);
            }
            OperationMessage input = this.Messages.Input;

            if (input != null)
            {
                if (operationBinding.Input == null)
                {
                    return(false);
                }
                string str = this.GetMessageName(base.Name, input.Name, true);
                if (this.GetMessageName(operationBinding.Name, operationBinding.Input.Name, true) != str)
                {
                    return(false);
                }
            }
            else if (operationBinding.Input != null)
            {
                return(false);
            }
            OperationMessage output = this.Messages.Output;

            if (output != null)
            {
                if (operationBinding.Output == null)
                {
                    return(false);
                }
                string str3 = this.GetMessageName(base.Name, output.Name, false);
                if (this.GetMessageName(operationBinding.Name, operationBinding.Output.Name, false) != str3)
                {
                    return(false);
                }
            }
            else if (operationBinding.Output != null)
            {
                return(false);
            }
            return(true);
        }
コード例 #4
0
ファイル: SampleGenerator.cs プロジェクト: umabiel/WsdlUI
        public string GenerateHttpGetMessage(Port port, OperationBinding obin, Operation oper, OperationMessage msg)
        {
            string req = "";

            if (msg is OperationInput) {
                HttpAddressBinding sab = port.Extensions.Find(typeof(HttpAddressBinding)) as HttpAddressBinding;
                HttpOperationBinding sob = obin.Extensions.Find(typeof(HttpOperationBinding)) as HttpOperationBinding;
                string location = new Uri(sab.Location).AbsolutePath + sob.Location + "?" + BuildQueryString(msg);
                req += "GET " + location + "\n";
                req += "Host: " + GetLiteral("string");
            }
            else {
                req += "HTTP/1.0 200 OK\n";
                req += "Content-Type: text/xml; charset=utf-8\n";
                req += "Content-Length: " + GetLiteral("string") + "\n\n";

                MimeXmlBinding mxb = (MimeXmlBinding)obin.Output.Extensions.Find(typeof(MimeXmlBinding)) as MimeXmlBinding;
                if (mxb == null) return req;

                Message message = descriptions.GetMessage(msg.Message);
                XmlQualifiedName ename = null;
                foreach (MessagePart part in message.Parts)
                    if (part.Name == mxb.Part) ename = part.Element;

                if (ename == null) return req + GetLiteral("string");

                StringWriter sw = new StringWriter();
                XmlTextWriter xtw = new XmlTextWriter(sw);
                xtw.Formatting = Formatting.Indented;
                currentUse = SoapBindingUse.Literal;
                WriteRootElementSample(xtw, ename);
                xtw.Close();
                req += sw.ToString();
            }

            return req;
        }
コード例 #5
0
        /// <summary>
        /// Determines if this operations message is Document/Literal
        /// </summary>
        /// <param name="operation">An OperationMessage object containing the operation to check.</param>
        /// <returns>True if the binding style="document" and soap12Binding operaiton use="literal" else false.</returns>
        internal static bool IsDocumentLiteral(OperationMessage operationMessage)
        {
            bool docStyle = true;
            Binding soapBinding = null;
            if (operationMessage.Operation.PortType.ServiceDescription.Bindings != null)
            {
                foreach (Binding binding in operationMessage.Operation.PortType.ServiceDescription.Bindings)
                {
                    // Make sure this is the right binding
                    if (binding.Type.Name == operationMessage.Operation.PortType.Name)
                    {

                        // If this is the soap12 binding set the style and break;
                        if (binding.Extensions.Find(typeof(Soap12Binding)) != null)
                        {
                            soapBinding = binding;
                            for (int i = 0; i < soapBinding.Extensions.Count; ++i)
                            {
                                if (soapBinding.Extensions[i] is Soap12Binding)
                                    if (((Soap12Binding)soapBinding.Extensions[i]).Style == SoapBindingStyle.Rpc)
                                        docStyle = false;
                            }
                            break;
                        }
                    }
                }
                if (soapBinding != null)
                {
                    foreach (OperationBinding operationBinding in soapBinding.Operations)
                        if (operationBinding.Name == operationMessage.Operation.Name)
                        {
                            Soap12BodyBinding soapBodyBinding;
                            if (operationMessage is OperationInput)
                            {
                                soapBodyBinding = (Soap12BodyBinding)operationBinding.Input.Extensions.Find(typeof(Soap12BodyBinding));
                            }
                            else
                                soapBodyBinding = (Soap12BodyBinding)operationBinding.Output.Extensions.Find(typeof(Soap12BodyBinding));

                            if (soapBodyBinding != null)
                            {
                                // Since no one uses use="encoded" anymore throw else use="literal"
                                if (soapBodyBinding.Use == SoapBindingUse.Encoded)
                                    throw new XmlException("Invalid operation binding use \"encoded\" is not supported. Operation Name = " + operationMessage.Name);
                                return docStyle;
                            }
                        }
                }
                Logger.WriteLine("No wsdl Soap12Binding detected. Assuming style=\"document\" use=\"literal\"", LogLevel.Normal);
                return true;
            }
            Logger.WriteLine("No wsdl binding section detected. Assuming style=\"document\" use=\"literal\"", LogLevel.Normal);
            return true;
        }
コード例 #6
0
ファイル: SampleGenerator.cs プロジェクト: umabiel/WsdlUI
 string BuildQueryString(OperationMessage opm)
 {
     string s = "";
     Message msg = descriptions.GetMessage(opm.Message);
     foreach (MessagePart part in msg.Parts) {
         if (s.Length != 0) s += "&";
         s += part.Name + "=" + GetLiteral(part.Type.Name);
     }
     return s;
 }
コード例 #7
0
ファイル: SampleGenerator.cs プロジェクト: umabiel/WsdlUI
        public string GenerateHttpSoapMessage(Port port, OperationBinding obin, Operation oper, OperationMessage msg)
        {
            string req = "";

            if (msg is OperationInput) {
                SoapAddressBinding sab = port.Extensions.Find(typeof(SoapAddressBinding)) as SoapAddressBinding;
                SoapOperationBinding sob = obin.Extensions.Find(typeof(SoapOperationBinding)) as SoapOperationBinding;

                req += "POST " + GetAbsolutePath(sab.Location) + "\n";
                req += "SOAPAction: " + sob.SoapAction + "\n";
                req += "Content-Type: text/xml; charset=utf-8\n";
                req += "Content-Length: " + GetLiteral("string") + "\n";
                req += "Host: " + GetLiteral("string") + "\n\n";
            }
            else {
                req += "HTTP/1.0 200 OK\n";
                req += "Content-Type: text/xml; charset=utf-8\n";
                req += "Content-Length: " + GetLiteral("string") + "\n\n";
            }

            req += GenerateSoapMessage(obin, oper, msg);
            return req;
        }
コード例 #8
0
ファイル: WsdlExporterTest.cs プロジェクト: nlhepler/mono
		void CheckOperationMessage (OperationMessage opmsg, string msg, Type type, string action)
		{
			Assert.AreEqual (type, opmsg.GetType (), "#com1");
			Assert.AreEqual (msg, opmsg.Message.ToString (), "#com2");
			Assert.AreEqual (0, opmsg.Extensions.Count, "#com3");
			Assert.AreEqual (1, opmsg.ExtensibleAttributes.Length, "#com4");
			Assert.IsNull (opmsg.Name, "#com5");

			XmlAttribute attr = opmsg.ExtensibleAttributes [0];
			Assert.AreEqual ("Action", attr.LocalName, "#ca1");
			Assert.AreEqual ("http://www.w3.org/2006/05/addressing/wsdl", attr.NamespaceURI, "#ca2");
			Assert.AreEqual (action, attr.Value, "#ca3");
		}
コード例 #9
0
 /// <include file='doc\ServiceDescription.uex' path='docs/doc[@for="OperationMessageCollection.IndexOf"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(OperationMessage operationMessage) {
     return List.IndexOf(operationMessage);
 }
コード例 #10
0
		string GetOperMessageName (OperationMessage msg, string operName)
		{
			if (msg.Name == null) return operName;
			else return msg.Name;
		}
コード例 #11
0
 public int Add(OperationMessage operationMessage)
 {
     return(base.List.Add(operationMessage));
 }
 public MessageDescription GetMessageDescription(OperationMessage operationMessage)
 {
     return this.messageDescriptions[operationMessage];
 }
 internal void AddMessage(MessageDescription messageDescription, OperationMessage wsdlOperationMessage)
 {
     this.wsdlOperationMessages.Add(messageDescription, wsdlOperationMessage);
     this.messageDescriptions.Add(wsdlOperationMessage, messageDescription);
 }
コード例 #14
0
 internal static void AddActionAttribute(string actionUri, OperationMessage wsdlOperationMessage, PolicyVersion policyVersion)
 {
     System.Xml.XmlAttribute attribute;
     if (policyVersion == PolicyVersion.Policy12)
     {
         attribute = WsdlExporter.XmlDoc.CreateAttribute("wsaw", "Action", "http://www.w3.org/2006/05/addressing/wsdl");
     }
     else
     {
         attribute = WsdlExporter.XmlDoc.CreateAttribute("wsam", "Action", "http://www.w3.org/2007/05/addressing/metadata");
     }
     attribute.Value = actionUri;
     wsdlOperationMessage.ExtensibleAttributes = new System.Xml.XmlAttribute[] { attribute };
 }
コード例 #15
0
		public MessageDescription GetMessageDescription (
			OperationMessage operationMessage)
		{
			throw new NotImplementedException ();
		}
コード例 #16
0
		public int Add (OperationMessage operationMessage) 
		{
			Insert (Count, operationMessage);
			return (Count - 1);
		}
コード例 #17
0
 /// <include file='doc\ServiceDescription.uex' path='docs/doc[@for="OperationMessageCollection.Add"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int Add(OperationMessage operationMessage) {
     return List.Add(operationMessage);
 }
コード例 #18
0
ファイル: ConformanceChecker.cs プロジェクト: nobled/mono
		public virtual void Check (ConformanceCheckContext ctx, OperationMessage value) { }
コード例 #19
0
 /// <include file='doc\ServiceDescription.uex' path='docs/doc[@for="OperationMessageCollection.Remove"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Remove(OperationMessage operationMessage) {
     List.Remove(operationMessage);
 }
コード例 #20
0
		public override void Check (ConformanceCheckContext ctx, OperationMessage value) { }
コード例 #21
0
 internal void AddMessage(MessageDescription messageDescription, WsdlNS.OperationMessage wsdlOperationMessage)
 {
     _wsdlOperationMessages.Add(messageDescription, wsdlOperationMessage);
     _messageDescriptions.Add(wsdlOperationMessage, messageDescription);
 }
コード例 #22
0
ファイル: DCCodeGen.cs プロジェクト: awakegod/NETMF-LPC
        /// <summary>
        /// For a given wsdl service operation, generate an Rpc or document style wrapped data contract
        /// and data contract serializer.
        /// </summary>
        /// <param name="BindingStyle">A flag indicating the binding style.</param>
        /// <param name="operationMessage">A OperationMessage type containing an OperationInput or OperationOutput type.</param>
        /// <param name="messageParts">A collection of message parts used by the operation.</param>
        /// <param name="messageTypes">An arraylist of message elements and or types used by the operation.</param>
        private void GenerateWrappedContracts(BindingStyle bindingStyle, OperationMessage operationMessage, MessagePartCollection messageParts, ArrayList messageTypes)
        {
            if (messageTypes.Count == 0)
                return;
            
            // Rules: Rpc/Literal support only. WS-I basic profile Rpc/Literal rules apply.
            
            // Create a temporary wrapper element type that will be used to wrap the message parts.
            // As per rpc/literal spec the name of the type is the name of the operation
            // If the message is a response the name = the operation name + "Response".
            // The temporary wrapper element is stored in a new schema that will be added to the existing
            // ServiceDescription schema set and recompiled to resolve all type references.
            XmlSchema schema = operationMessage.Operation.PortType.ServiceDescription.Types.Schemas[0];
            XmlSchemaSet schemaSet = new XmlSchemaSet();
            XmlSchemaElement wrapperElement = new XmlSchemaElement();
            schema.Items.Add(wrapperElement);
            string elementName = operationMessage.Operation.Name;
            elementName = operationMessage is OperationOutput ? elementName + "Response" : elementName + "Request";
            wrapperElement.Name = elementName;

            // The element namespace is the target namespace by default else it is 
            // defined by the binding/operation/soap12Body/namespace attribute
            schema.TargetNamespace = CodeGenUtils.GetOperationNamespace(operationMessage);

            // Add a new complex type to the element
            XmlSchemaComplexType complexType = new XmlSchemaComplexType();
            wrapperElement.SchemaType = complexType;

            // Add a sequence particles to the complex type
            XmlSchemaSequence sequence = new XmlSchemaSequence();
            complexType.Particle = sequence;

            // Loop through the list of parts and add thier definitions to the sequence
            for (int i = 0; i < messageTypes.Count; ++i)
            {
                if (bindingStyle == BindingStyle.Rpc)
                {
                    XmlSchemaElement typeElement = new XmlSchemaElement();
                    typeElement.Name = messageParts[i].Name;
                    typeElement.SchemaTypeName = new XmlQualifiedName(messageParts[i].Type.Name, messageParts[i].Type.Namespace);
                    sequence.Items.Add(typeElement);
                    schema.Items.Add((XmlSchemaType)messageTypes[i]);
                }
                else
                    sequence.Items.Add((XmlSchemaElement)messageTypes[i]);
            }

            // Add the new schema containing the new element to a set and compile
            schemaSet.Add(schema);
            schemaSet.Compile();

            // Build the new element and serializer
            CodeTypeDeclaration codeType = new CodeTypeDeclaration();
            CodeNamespace codeNs = CodeGenUtils.GetDotNetNamespace(m_codeNamespaces, wrapperElement.QualifiedName.Namespace);
            BuildElementType(wrapperElement, codeType);
            if (!CodeGenUtils.TypeExists(codeNs, codeType.Name))
            {
                codeNs.Types.Add(codeType);
                m_dcsCodeGen.BuildDataContractSerializer(m_encodingType, codeType, codeNs);
            }

            // Swap the existing message parts with a new replacement part. All subsequent processing
            // will use the new single message part
            foreach (Message message in operationMessage.Operation.PortType.ServiceDescription.Messages)
            {
                if (message.Name == operationMessage.Message.Name)
                {
                    MessagePart replacementPart = new MessagePart();
                    replacementPart.Element = new XmlQualifiedName(elementName);
                    replacementPart.Type = wrapperElement.QualifiedName;
                    replacementPart.Name = operationMessage.Name;
                    replacementPart.Namespaces = operationMessage.Namespaces;
                    message.Parts.Clear();
                    message.Parts.Add(replacementPart);
                    break;
                }
            }
        }
コード例 #23
0
 public override void Check(ConformanceCheckContext ctx, OperationMessage value)
 {
 }
コード例 #24
0
ファイル: DCCodeGen.cs プロジェクト: awakegod/NETMF-LPC
        /// <summary>
        /// For a given wsdl service operation, generate a data contract and data contract serializer for
        /// each element used by the operation.
        /// </summary>
        /// <param name="operationMessage">A OperationMessage type containing an OperationInput or OperationOutput type.</param>
        /// <param name="messageParts">A collection of message parts used by the operation.</param>
        /// <param name="messageTypes">An arraylist of message elements and or types used by the operation.</param>
        public void GenerateContracts(OperationMessage operationMessage, MessagePartCollection messageParts, ArrayList messageTypes)
        {
            // If style = document and use = literal
            // Doc/Lit must have no parts or 1 to n elements
            if (CodeGenUtils.IsDocumentLiteral(operationMessage))
            {
                // Document literal parts can only contain element references. Do a quick check.
                for (int i = 0; i < messageTypes.Count; ++i)
                    if (!(messageTypes[0] is XmlSchemaElement))
                        throw new XmlException("Invalid wsdl:message element: " +
                            ((XmlSchemaType)messageTypes[0]).Name +
                            ". Document/Literal message parts must contain element attributes or no attributes.");
                
                CodeTypeDeclaration codeType = new CodeTypeDeclaration();

                // Check for wrapped style
                bool isWrapped = false;
                if (messageParts != null && messageParts.Count > 0 && CodeGenUtils.IsWrapped(messageParts[0]))
                    isWrapped = true;

                // If this is wrapped and has more than one message part throw
                if (isWrapped && messageParts.Count > 1)
                    throw new XmlException("Invalid number of message parts for document/literal/wrapped message \"" + operationMessage.Message.Name + "\".");

                // If wrapped process single element. For now assume as long as there is one part this is wrapped.
                if (isWrapped || messageParts.Count == 1)
                {
                    XmlSchemaElement element = (XmlSchemaElement)messageTypes[0];
                    CodeNamespace codeNs = CodeGenUtils.GetDotNetNamespace(m_codeNamespaces, element.QualifiedName.Namespace);
                    BuildElementType(element, codeType);
                }
                else
                {
                    // If the WS-I compliance flag is set document/literal can have at most one
                    // message part so throw if we get here
                    if (m_wsiCompliant)
                        throw new XmlException("Invalid number of message parts for WS-I compliant document/literal message \"" + operationMessage.Message.Name + "\".");

                    // To simplify parameter passing to and from serailizers, like Rpc/Literal, seperate doc/lit
                    // element parts (parameters) are wrapped in an object. This will not affect the format of the
                    // actual XML messages, it will only affect parameters and return types exchnged by the
                    // serializers and implementation contracts. 

                    // Generate Document style contracts
                    GenerateWrappedContracts(BindingStyle.Document, operationMessage, messageParts, messageTypes);
                }
            }
            // Else this is an rpc/literal message
            else
            {
                if (!m_rpcStyleSupport)
                    throw new XmlException("Rpc binding style is not supported. Operation = \"" + operationMessage.Operation.Name + "\".");
                
                // For rpc literal parts can only contain type references. Do a quick check.
                for (int i = 0; i < messageTypes.Count; ++i)
                    if (messageTypes[0] is XmlSchemaElement)
                        throw new XmlException("Invalid wsdl:message type: " +
                            ((XmlSchemaElement)messageTypes[0]).Name +
                            ". Rpc/Literal message parts must contain type attributes or no attributes.");

                // Generate Rpc style contracts
                GenerateWrappedContracts(BindingStyle.Rpc, operationMessage, messageParts, messageTypes);
            }
        }
コード例 #25
0
ファイル: SampleGenerator.cs プロジェクト: umabiel/WsdlUI
        public string GenerateSoapMessage(OperationBinding obin, Operation oper, OperationMessage msg)
        {
            SoapOperationBinding sob = obin.Extensions.Find(typeof(SoapOperationBinding)) as SoapOperationBinding;
            SoapBindingStyle style = (sob != null) ? sob.Style : SoapBindingStyle.Document;

            MessageBinding msgbin = (msg is OperationInput) ? (MessageBinding)obin.Input : (MessageBinding)obin.Output;
            SoapBodyBinding sbb = msgbin.Extensions.Find(typeof(SoapBodyBinding)) as SoapBodyBinding;
            SoapBindingUse bodyUse = (sbb != null) ? sbb.Use : SoapBindingUse.Literal;

            StringWriter sw = new StringWriter();
            XmlTextWriter xtw = new XmlTextWriter(sw);
            xtw.Formatting = Formatting.Indented;

            xtw.WriteStartDocument();
            xtw.WriteStartElement("soap", "Envelope", SoapEnvelopeNamespace);
            xtw.WriteAttributeString("xmlns", "xsi", null, XmlSchema.InstanceNamespace);
            xtw.WriteAttributeString("xmlns", "xsd", null, XmlSchema.Namespace);

            if (bodyUse == SoapBindingUse.Encoded) {
                xtw.WriteAttributeString("xmlns", "soapenc", null, SoapEncodingNamespace);
                xtw.WriteAttributeString("xmlns", "tns", null, msg.Message.Namespace);
            }

            // Serialize headers

            bool writtenHeader = false;
            foreach (object ob in msgbin.Extensions) {
                SoapHeaderBinding hb = ob as SoapHeaderBinding;
                if (hb == null) continue;

                if (!writtenHeader) {
                    xtw.WriteStartElement("soap", "Header", SoapEnvelopeNamespace);
                    writtenHeader = true;
                }

                WriteHeader(xtw, hb);
            }

            if (writtenHeader)
                xtw.WriteEndElement();

            // Serialize body
            xtw.WriteStartElement("soap", "Body", SoapEnvelopeNamespace);

            currentUse = bodyUse;
            WriteBody(xtw, oper, msg, sbb, style);

            xtw.WriteEndElement();
            xtw.WriteEndElement();
            xtw.Close();
            return sw.ToString();
        }
コード例 #26
0
		Message FindMessage (OperationMessage om)
		{
			foreach (WSDL sd in importer.WsdlDocuments)
				if (sd.TargetNamespace == om.Message.Namespace)
					foreach (Message msg in sd.Messages)
						if (msg.Name == om.Message.Name)
							return msg;
			return null;
		}
コード例 #27
0
ファイル: SampleGenerator.cs プロジェクト: umabiel/WsdlUI
        void WriteBody(XmlTextWriter xtw, Operation oper, OperationMessage opm, SoapBodyBinding sbb, SoapBindingStyle style)
        {
            Message msg = descriptions.GetMessage(opm.Message);
            if (msg.Parts.Count > 0 && msg.Parts[0].Name == "parameters") {
                MessagePart part = msg.Parts[0];
                if (part.Element == XmlQualifiedName.Empty)
                    WriteTypeSample(xtw, part.Type);
                else
                    WriteRootElementSample(xtw, part.Element);
            }
            else {
                string elemName = oper.Name;
                string ns = "";
                if (opm is OperationOutput) elemName += "Response";

                if (style == SoapBindingStyle.Rpc) {
                    xtw.WriteStartElement(elemName, sbb.Namespace);
                    ns = sbb.Namespace;
                }

                foreach (MessagePart part in msg.Parts) {
                    if (part.Element == XmlQualifiedName.Empty) {
                        XmlSchemaElement elem = new XmlSchemaElement();
                        elem.SchemaTypeName = part.Type;
                        elem.Name = part.Name;
                        WriteElementSample(xtw, ns, elem);
                    }
                    else
                        WriteRootElementSample(xtw, part.Element);
                }

                if (style == SoapBindingStyle.Rpc)
                    xtw.WriteEndElement();
            }
            WriteQueuedTypeSamples(xtw);
        }
コード例 #28
0
 public int Add(OperationMessage operationMessage)
 {
     Insert(Count, operationMessage);
     return(Count - 1);
 }
コード例 #29
0
ファイル: SampleGenerator.cs プロジェクト: umabiel/WsdlUI
        public string GenerateHttpPostMessage(Port port, OperationBinding obin, Operation oper, OperationMessage msg)
        {
            string req = "";

            if (msg is OperationInput) {
                HttpAddressBinding sab = port.Extensions.Find(typeof(HttpAddressBinding)) as HttpAddressBinding;
                HttpOperationBinding sob = obin.Extensions.Find(typeof(HttpOperationBinding)) as HttpOperationBinding;
                string location = new Uri(sab.Location).AbsolutePath + sob.Location;
                req += "POST " + location + "\n";
                req += "Content-Type: application/x-www-form-urlencoded\n";
                req += "Content-Length: " + GetLiteral("string") + "\n";
                req += "Host: " + GetLiteral("string") + "\n\n";
                req += BuildQueryString(msg);
            }
            else return GenerateHttpGetMessage(port, obin, oper, msg);

            return req;
        }
コード例 #30
0
 public bool Contains(OperationMessage operationMessage)
 {
     return(List.Contains(operationMessage));
 }
コード例 #31
0
        /// <summary>
        /// Determines if this operations message is Document/Literal
        /// </summary>
        /// <param name="operation">An OperationMessage object containing the operation to check.</param>
        /// <returns>
        /// A string containing the namespace defined by the binding/operation/soap12Body/namespace attribute
        /// if found else the target namespace is assumed.
        /// </returns>
        internal static string GetOperationNamespace(OperationMessage operationMessage)
        {
            string operationNs = null;
            Binding soapBinding = null;
            if (operationMessage.Operation.PortType.ServiceDescription.Bindings != null)
            {
                foreach (Binding binding in operationMessage.Operation.PortType.ServiceDescription.Bindings)
                {
                    // If this is the soap12 binding set the style and break;
                    if (binding.Extensions.Find(typeof(Soap12Binding)) != null)
                    {
                        soapBinding = binding;
                        break;
                    }
                }
                if (soapBinding != null)
                {
                    foreach (OperationBinding operationBinding in soapBinding.Operations)
                        if (operationBinding.Name == operationMessage.Operation.Name)
                        {
                            Soap12BodyBinding soapBodyBinding;
                            if (operationMessage is OperationInput)
                            {
                                soapBodyBinding = (Soap12BodyBinding)operationBinding.Input.Extensions.Find(typeof(Soap12BodyBinding));
                            }
                            else
                                soapBodyBinding = (Soap12BodyBinding)operationBinding.Output.Extensions.Find(typeof(Soap12BodyBinding));

                            if (soapBodyBinding != null)
                            {
                                operationNs = soapBodyBinding.Namespace;
                                break;
                            }
                        }
                }
            }
            return operationNs == "" ? operationMessage.Operation.PortType.ServiceDescription.TargetNamespace : operationNs;
        }
コード例 #32
0
 public int IndexOf(OperationMessage operationMessage)
 {
     return(List.IndexOf(operationMessage));
 }
コード例 #33
0
 public void Insert(int index, OperationMessage operationMessage)
 {
     List.Insert(index, operationMessage);
 }
コード例 #34
0
 public void Remove(OperationMessage operationMessage)
 {
     List.Remove(operationMessage);
 }
コード例 #35
0
 /// <include file='doc\ServiceDescription.uex' path='docs/doc[@for="OperationMessageCollection.Insert"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Insert(int index, OperationMessage operationMessage) {
     List.Insert(index, operationMessage);
 }
コード例 #36
0
ファイル: ConformanceChecker.cs プロジェクト: Tsalex71/mono-1
 public virtual void Check(ConformanceCheckContext ctx, OperationMessage value)
 {
 }
コード例 #37
0
 /// <include file='doc\ServiceDescription.uex' path='docs/doc[@for="OperationMessageCollection.Contains"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public bool Contains(OperationMessage operationMessage) {
     return List.Contains(operationMessage);
 }
コード例 #38
0
 public MessageDescription GetMessageDescription(WsdlNS.OperationMessage operationMessage)
 {
     return(_messageDescriptions[operationMessage]);
 }
コード例 #39
0
 /// <include file='doc\ServiceDescription.uex' path='docs/doc[@for="OperationMessageCollection.CopyTo"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void CopyTo(OperationMessage[] array, int index) {
     List.CopyTo(array, index);
 }
コード例 #40
0
		public void InitializeOperation()
		{
			// workaround: OperationInput, OperationOutput and OperationFault are all empty derivations of OperationMessage
			operation = new OperationInput();
		}