当前位置: 首页>>代码示例>>C#>>正文


C# Soap.WsMessage类代码示例

本文整理汇总了C#中Ws.Services.Soap.WsMessage的典型用法代码示例。如果您正苦于以下问题:C# WsMessage类的具体用法?C# WsMessage怎么用?C# WsMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WsMessage类属于Ws.Services.Soap命名空间,在下文中一共展示了WsMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetData

        public virtual WsMessage GetData(WsMessage request)
        {
            // Build request object
            GetDataDataContractSerializer reqDcs;
            reqDcs = new GetDataDataContractSerializer("GetData", "http://tempuri.org/");
            reqDcs.BodyParts = request.BodyParts;
            GetData req;
            req = ((GetData)(reqDcs.ReadObject(request.Reader)));

            // Create response object
            // Call service operation to process request and return response.
            GetDataResponse resp;
            resp = m_service.GetData(req);

            // Create response header
            WsWsaHeader respHeader = new WsWsaHeader("http://tempuri.org/IDataAccessService/GetDataResponse", request.Header.MessageID, m_version.AnonymousUri, null, null, null);
            WsMessage response = new WsMessage(respHeader, resp, WsPrefix.Wsdp);

            // Create response serializer
            GetDataResponseDataContractSerializer respDcs;
            respDcs = new GetDataResponseDataContractSerializer("GetDataResponse", "http://tempuri.org/");
            response.Serializer = respDcs;

            // Indicate that message is Mtom encoded
            response.BodyParts = new WsMtomBodyParts();
            return response;
        }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:27,代码来源:Service1HostedService.cs

示例2: TwoWayRequest

        // TwoWayRequest: Accept two integer values, return their sum
        public WsMessage TwoWayRequest(WsMessage request)
        {
            WsWsaHeader header = request.Header;
            XmlReader reader = request.Reader;

            try
            {
                // Find beginning of request
                reader.ReadStartElement("TwoWayRequest", SimpleServiceNamespaceUri);

                // Find the values to be added
                int X = Convert.ToInt32(reader.ReadElementString("X", SimpleServiceNamespaceUri));
                int Y = Convert.ToInt32(reader.ReadElementString("Y", SimpleServiceNamespaceUri));

                //Log.Comment("");
                //Log.Comment("X = " + X.ToString() + " Y = " + Y.ToString());
                //Log.Comment(X.ToString() + " + " + Y.ToString() + " = " + ((int)(X + Y)).ToString());
                //Log.Comment("");

                // Return the response
                return TwoWayResponse(header, X + Y);
            }
            catch (Exception e)
            {
                // Something went wrong 
                throw new WsFaultException(header, WsFaultType.XmlException, e.ToString());
            }
        }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:29,代码来源:SimpleService.cs

示例3: OneWayAttachment

        public virtual void OneWayAttachment(OneWayAttachmentRequest req)
        {

            // Create request header
            String action;
            action = "http://schemas.example.org/AttachmentService/OneWayAttachment";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            OneWayAttachmentRequestDataContractSerializer reqDcs;
            reqDcs = new OneWayAttachmentRequestDataContractSerializer("OneWayAttachmentRequest", "http://schemas.example.org/AttachmentService");
            request.Serializer = reqDcs;
            request.Method = "OneWayAttachment";


            // Indicate that this message will use Mtom encoding
            request.BodyParts = new WsMtomBodyParts();

            // Send service request
            m_requestChannel.Open();
            m_requestChannel.RequestOneWay(request);
            m_requestChannel.Close();
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:25,代码来源:AttachmentServiceClientProxy.cs

示例4: TwoWayAttachment

        public virtual WsMessage TwoWayAttachment(WsMessage request)
        {
            // Build request object
            TwoWayAttachmentRequestDataContractSerializer reqDcs;
            reqDcs = new TwoWayAttachmentRequestDataContractSerializer("TwoWayAttachmentRequest", "http://schemas.example.org/AttachmentService");
            reqDcs.BodyParts = request.BodyParts;
            TwoWayAttachmentRequest req;
            req = ((TwoWayAttachmentRequest)(reqDcs.ReadObject(request.Reader)));
            request.Reader.Dispose();
            request.Reader = null;

            // Create response object
            // Call service operation to process request and return response.
            TwoWayAttachmentResponse resp;
            resp = m_service.TwoWayAttachment(req);

            // Create response header
            WsWsaHeader respHeader = new WsWsaHeader("http://schemas.example.org/AttachmentService/TwoWayAttachmentResponse", request.Header.MessageID, m_version.AnonymousUri, null, null, null);
            WsMessage response = new WsMessage(respHeader, resp, WsPrefix.Wsdp);

            // Create response serializer
            TwoWayAttachmentResponseDataContractSerializer respDcs;
            respDcs = new TwoWayAttachmentResponseDataContractSerializer("TwoWayAttachmentResponse", "http://schemas.example.org/AttachmentService");
            response.Serializer = respDcs;

            // Indicate that message is Mtom encoded
            response.BodyParts = new WsMtomBodyParts();
            return response;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:29,代码来源:AttachmentServiceHostedService.cs

示例5: Borrow

        public virtual BorrowResponse Borrow(Borrow req)
        {
            // Create request header
            String action;
            action = "http://tempuri.org/IService/Borrow";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            BorrowDataContractSerializer reqDcs;
            reqDcs = new BorrowDataContractSerializer("Borrow", "http://tempuri.org/");
            request.Serializer = reqDcs;
            request.Method = "Borrow";

            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);
            m_requestChannel.Close();

            // Process response
            BorrowResponseDataContractSerializer respDcs;
            respDcs = new BorrowResponseDataContractSerializer("BorrowResponse", "http://tempuri.org/");
            BorrowResponse resp;
            resp = ((BorrowResponse)(respDcs.ReadObject(response.Reader)));
            response.Reader.Dispose();
            response.Reader = null;
            return resp;
        }
开发者ID:giu-fio,项目名称:LibraryTerminal,代码行数:29,代码来源:ServiceClientProxy.cs

示例6: OneWay

        // OneWay: Accept an integer value
        public WsMessage OneWay(WsMessage request)
        {
            try
            {
                WsWsaHeader header = request.Header;
                XmlReader reader = request.Reader;

                // Find beginning of request
                reader.ReadStartElement("OneWay", SimpleServiceNamespaceUri);

                // Find the integer value
                int number = Convert.ToInt32(reader.ReadElementString("Param", SimpleServiceNamespaceUri));
                
                //Log.Comment("");
                //Log.Comment("Integer = " + number.ToString());
                //Log.Comment("");

                return null;     // Empty response
            }
            catch (Exception e)
            {
                // Something went wrong
                throw new WsFaultException(request.Header, WsFaultType.XmlException, e.ToString());
            }
        }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:26,代码来源:SimpleService.cs

示例7: SetData

        public virtual SetDataResponse SetData(SetData req)
        {

            // Create request header
            String action;
            action = "http://tempuri.org/IDataAccessService/SetData";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            SetDataDataContractSerializer reqDcs;
            reqDcs = new SetDataDataContractSerializer("SetData", "http://tempuri.org/");
            request.Serializer = reqDcs;
            request.Method = "SetData";


            // Indicate that this message will use Mtom encoding
            request.BodyParts = new WsMtomBodyParts();

            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);
            m_requestChannel.Close();

            // Process response
            SetDataResponseDataContractSerializer respDcs;
            respDcs = new SetDataResponseDataContractSerializer("SetDataResponse", "http://tempuri.org/");
            respDcs.BodyParts = response.BodyParts;
            SetDataResponse resp;
            resp = ((SetDataResponse)(respDcs.ReadObject(response.Reader)));
            return resp;
        }
开发者ID:trfiladelfo,项目名称:MicroFrameworkSDK-Mono,代码行数:33,代码来源:Service1ClientProxy.cs

示例8: TwoWay

        public virtual TwoWayResponse TwoWay(TwoWayRequest req)
        {

            // Create request header
            String action;
            action = "http://schemas.example.org/SimpleService/TwoWay";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            TwoWayRequestDataContractSerializer reqDcs;
            reqDcs = new TwoWayRequestDataContractSerializer("TwoWayRequest", "http://schemas.example.org/SimpleService");
            request.Serializer = reqDcs;
            request.Method = "TwoWay";


            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);
            m_requestChannel.Close();

            // Process response
            TwoWayResponseDataContractSerializer respDcs;
            respDcs = new TwoWayResponseDataContractSerializer("TwoWayResponse", "http://schemas.example.org/SimpleService");
            TwoWayResponse resp;
            resp = ((TwoWayResponse)(respDcs.ReadObject(response.Reader)));
            return resp;
        }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:29,代码来源:SimpleServiceClientProxy.cs

示例9: OneWayAttachment

        // OneWayAttachment: receive an MTOM binary attachment
        public WsMessage OneWayAttachment(WsMessage request)
        {
            WsWsaHeader header = request.Header;
            XmlReader reader = request.Reader;

            // Make sure we have MTOM body parts
            if (request.BodyParts == null)
                throw new WsFaultException(header, WsFaultType.XmlException, "MTOM message has no body parts.");

            // Find paramaters
            reader.ReadStartElement("OneWayAttachment", AttNamespace);
            reader.ReadStartElement("Param", AttNamespace);

            // Look for Include parameter
            if (reader.IsStartElement("Include", WsWellKnownUri.XopNamespaceUri) == false)
                throw new WsFaultException(header, WsFaultType.XmlException, "Body/OneWayAttachment/Param/Include is missing.");

            // Look for attachment body part
            reader.MoveToFirstAttribute();
            string cid = "<" + reader.Value.Substring(4) + ">";
            ////Log.Comment("");
            ////Log.Comment("OneWayAttachment received. href = " + reader.Value);
            WsMtomBodyPart bodyPart;
            if ((bodyPart = request.BodyParts[cid]) == null)
                throw new WsFaultException(header, WsFaultType.XmlException, "Required body part \"" + reader.Value + "\" in missing.");

            // Print information about the attachment
            ////Log.Comment("Attachment size = " + bodyPart.Content.Length);
            ////Log.Comment("Content-ID = " + bodyPart.ContentID);
            ////Log.Comment("Content-Type = " + bodyPart.ContentType);
            ////Log.Comment("Content-Transfer-Encoding = " + bodyPart.ContentTransferEncoding);
            ////Log.Comment("");

            return null;     // empty response
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:36,代码来源:AttachmentService.cs

示例10: HelloWCF

        public virtual HelloWCFResponse HelloWCF(HelloWCF req)
        {

            // Create request header
            String action;
            action = "http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCF";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            HelloWCFDataContractSerializer reqDcs;
            reqDcs = new HelloWCFDataContractSerializer("HelloWCF", "http://localhost/ServiceHelloWCF");
            request.Serializer = reqDcs;
            request.Method = "HelloWCF";


            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);
            m_requestChannel.Close();

            // Process response
            HelloWCFResponseDataContractSerializer respDcs;
            respDcs = new HelloWCFResponseDataContractSerializer("HelloWCFResponse", "http://localhost/ServiceHelloWCF");
            HelloWCFResponse resp;
            resp = ((HelloWCFResponse)(respDcs.ReadObject(response.Reader)));
            response.Reader.Dispose();
            response.Reader = null;
            
            return resp;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:32,代码来源:ServiceHelloWCFClientProxy.cs

示例11: HelloWCF

        public virtual WsMessage HelloWCF(WsMessage request)
        {
            // Build request object
            HelloWCFDataContractSerializer reqDcs;
            reqDcs = new HelloWCFDataContractSerializer("HelloWCF", "http://localhost/ServiceHelloWCF");
            HelloWCF req;
            req = ((HelloWCF)(reqDcs.ReadObject(request.Reader)));
            request.Reader.Dispose();
            request.Reader = null;

            // Create response object
            // Call service operation to process request and return response.
            HelloWCFResponse resp;
            resp = m_service.HelloWCF(req);

            // Create response header
            WsWsaHeader respHeader = new WsWsaHeader("http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCFResponse", request.Header.MessageID, m_version.AnonymousUri, null, null, null);
            WsMessage response = new WsMessage(respHeader, resp, WsPrefix.Wsdp);

            // Create response serializer
            HelloWCFResponseDataContractSerializer respDcs;
            respDcs = new HelloWCFResponseDataContractSerializer("HelloWCFResponse", "http://localhost/ServiceHelloWCF");
            response.Serializer = respDcs;
            return response;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:25,代码来源:ServiceHelloWCFHostedService.cs

示例12: ProcessOutputMessage

        /// <summary>
        /// Processes an output message for a specific context
        /// </summary>
        /// <param name="message">The message to process.</param>
        /// <param name="ctx">The context to process the message for.</param>
        /// <returns><c>true</c> if the processing was succesfull, <c>false</c>otherwise.</returns>
        public bool ProcessOutputMessage(ref WsMessage message, BindingContext ctx)
        {
            ChainResult res = this.OnProcessOutputMessage( ref message, ctx );
            if( ChainResult.Continue == res && m_Next != null)
            {
                return m_Next.ProcessOutputMessage( ref message, ctx );
            }

            return res == ChainResult.Handled;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:16,代码来源:BindingElement.cs

示例13: ProcessMatch

        private DpwsServiceDescriptions ProcessMatch(DpwsServiceDescription.ServiceDescriptionType type, WsMessage response, string messageID, IPEndPoint remoteEP, WsMessageCheck messageCheck)
        {
            Microsoft.SPOT.Debug.Assert(type == DpwsServiceDescription.ServiceDescriptionType.ProbeMatch
                || type == DpwsServiceDescription.ServiceDescriptionType.ResolveMatch);

            // Parse and build header
            WsWsaHeader header = response.Header;
            XmlReader   reader = response.Reader;

            if(header == null || reader == null)
            {
                return null;
            }

            try
            {
                // Make sure this is a probe matches response
                String headerAction = (type == DpwsServiceDescription.ServiceDescriptionType.ProbeMatch) ?
                    m_version.DiscoveryNamespace + "/ProbeMatches" :
                    m_version.DiscoveryNamespace + "/ResolveMatches";

                if (header.Action != headerAction)
                    return null;

                // Make sure this is not a duplicate probe response
                if (messageCheck != null)
                {
                    if (messageCheck.IsDuplicate(header.MessageID, remoteEP.ToString()) == true)
                    {
                        System.Ext.Console.Write("ProbeMatches / ResolveMatches - Duplicate response - " + header.Action + " received");
                        return null;
                    }
                }

                // Make sure the messageID matches the request ID
                if (header.RelatesTo != messageID)
                    return null;

                // Process the probe matches
#if DEBUG
                int depth = reader.Depth;
#endif
                DpwsServiceDescriptions matches = new DpwsServiceDescriptions(reader, type, m_version, remoteEP);
#if DEBUG
                Microsoft.SPOT.Debug.Assert(XmlReaderHelper.HasReadCompleteNode(depth, reader));
#endif

                return matches;
            }
            finally
            {
                reader.Close();
            }
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:54,代码来源:DpwsDiscoClientProcessor.cs

示例14: FireEvent

        /// <summary>
        /// Use this method to raise an event.
        /// </summary>
        /// <param name="hostedService">The hosted service that contains the event source.</param>
        /// <param name="eventSource">The event source that define the event.</param>
        /// <param name="eventMessage">The event message buffer.</param>
        /// <remarks>
        /// A device developer is responsible for building the event message buffer sent
        /// to clients that have an active event subscription with an event source. The subscription manager
        /// uses the hosted service parameter to access various properties of the service. The event source
        /// parameter is used to access the event sinks collection of the event source. Note: This method
        /// requires special provisions in order to properly build event message headers for each event sink.
        /// In order to send an event to a listening client the soap.header.To property must be changed for
        /// each listening client. In the future custom attribute support will solve this problem. For now
        /// however a search and replace mechanism is used to modifiy the header.To property. When a device
        /// developer builds the event message buffer they must use the search string WSDNOTIFYTOADDRESS for
        /// the To header property.
        /// </remarks>
        public void FireEvent(DpwsHostedService hostedService, DpwsWseEventSource eventSource, WsMessage msgEvt)
        {
            // Find the specified event source
            if (eventSource == null)
                throw new ArgumentNullException();
            
            DpwsWseEventSinks eventSinks = eventSource.EventSinks;

            // if there are event sources display message
            int count = eventSinks.Count;

            if (count > 0)
            {
                System.Ext.Console.Write("");
                System.Ext.Console.Write("Firing " + eventSource.Name);
                System.Ext.Console.Write("");
            }

            // Loop through event sinks and send the event message
            for (int i = count-1; i >= 0; i--)
            {
                DpwsWseEventSink eventSink = eventSinks[i];

                // Try to send event. If attempt fails delete the subscription/eventSink
                try
                {
                    msgEvt.Header = new WsWsaHeader(msgEvt.Header.Action, msgEvt.Header.RelatesTo, eventSink.NotifyTo.Address.AbsoluteUri,
                        null, null, eventSink.NotifyTo.RefParameters);

                    SendEvent(msgEvt, eventSink.NotifyTo.Address);
                }
                catch (Exception e)
                {
                    System.Ext.Console.Write("");
                    System.Ext.Console.Write("FireEvent failed. Deleting EventSink! NotifyToAddress = " + eventSink.NotifyTo.Address + " Exception: " + e.Message);
                    System.Ext.Console.Write("");

                    if (!(e is WebException))
                    {
                        try
                        {
                            // Send oneway subscription end message
                            SendSubscriptionEnd(eventSink, "DeliveryFailure", hostedService.ServiceID);
                        }
                        catch { }
                    }

                    // Remove event sink from event source list
                    eventSinks.RemoveAt(i);
                }
            }
        }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:70,代码来源:DpwsWseSubscriptionMgr.cs

示例15: CreateOneWayResponse

        public static WsMessage CreateOneWayResponse()
        {
            if (s_OneWayResponse == null)
            {
                WsWsaHeader header = new WsWsaHeader(null, null, null, null, null, null);

                header.IsOneWayResponse = true;

                s_OneWayResponse = new WsMessage(header, null, WsPrefix.None);
            }

            return s_OneWayResponse;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:13,代码来源:WsSoapDispatcher.cs


注:本文中的Ws.Services.Soap.WsMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。