• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WsaAddressing.WsWsaHeader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: BuildSoapMessage

        /// <summary>
        /// Helper method used to build a Dpws compliant soap response message.
        /// </summary>
        /// <param name="header">A valid response header object.</param>
        /// <param name="Dcs">A data contract serializer used to serialize the response body.</param>
        /// <param name="bodyContent">A object containing the data to serialize.</param>
        /// <returns>A byte array containing the soap reponse message.</returns>
        public static byte[] BuildSoapMessage(WsWsaHeader header, Ws.Services.Serialization.DataContractSerializer Dcs, object bodyContent)
        {
            lock (m_ThreadLock)
            {
                // Build response message
                MemoryStream soapStream;
                soapStream = new MemoryStream();
                XmlWriter xmlWriter;
                xmlWriter = XmlWriter.Create(soapStream);

                // Write start message up to body element content
                WsSoapMessageWriter.WriteSoapMessageStart(xmlWriter, WsSoapMessageWriter.Prefixes.Wsdp, null, header, null);

                // Serialize the body element
                if (bodyContent != null)
                {
                    Dcs.WriteObject(xmlWriter, bodyContent);
                }

                WsSoapMessageWriter.WriteSoapMessageEnd(xmlWriter);

                // Flush writer and build return array
                xmlWriter.Flush();
                byte[] soapBuffer = soapStream.ToArray();
                xmlWriter.Close();

                // Return soap message
                return soapBuffer;
            }
        }
开发者ID:prabby,项目名称:miniclr,代码行数:37,代码来源:WsServicesSerialization.cs


示例3: TwoWay

        public virtual WsMessage TwoWay(WsMessage request)
        {
            // Build request object
            TwoWayRequestDataContractSerializer reqDcs;
            reqDcs = new TwoWayRequestDataContractSerializer("TwoWayRequest", "http://schemas.example.org/SimpleService");
            TwoWayRequest req;
            req = ((TwoWayRequest)(reqDcs.ReadObject(request.Reader)));
            request.Reader.Dispose();
            request.Reader = null;

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

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

            // Create response serializer
            TwoWayResponseDataContractSerializer respDcs;
            respDcs = new TwoWayResponseDataContractSerializer("TwoWayResponse", "http://schemas.example.org/SimpleService");
            response.Serializer = respDcs;
            return response;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:25,代码来源:SimpleServiceHostedService.cs


示例4: WsFaultException

 public WsFaultException(WsWsaHeader header, WsFaultType faultType, String message, String detail)
 {
     this.Header = header;
     this.FaultType = faultType;
     _message = message;
     _detail = detail;
 }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:7,代码来源:WsFaults.cs


示例5: 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


示例6: 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


示例7: TwoWayRequest

        // TwoWayRequest: Accept two integer values, return their sum
        public byte[] TwoWayRequest(WsWsaHeader header, XmlReader 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,代码行数:26,代码来源:TestService.cs


示例8: 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


示例9: 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


示例10: 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


示例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: AnyCheckRequest

        public virtual AnyCheckResponse AnyCheckRequest(AnyCheckRequest req)
        {
            // Create request header
            String action;
            action = "http://schemas.example.org/SimpleService/AnyCheckRequest";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, ServiceEndpoint, null, EndpointAddress, null);

            // Create request serializer
            AnyCheckRequestDataContractSerializer reqDcs;
            reqDcs = new AnyCheckRequestDataContractSerializer("AnyCheckRequest", "http://schemas.example.org/SimpleService");

            // Build soap request message
            byte[] soapBuffer = SoapMessageBuilder.BuildSoapMessage(header, reqDcs, req);

            // Send service request
            DpwsHttpClient httpClient;
            httpClient = new DpwsHttpClient();
            DpwsSoapResponse response;
            response = httpClient.SendRequest(soapBuffer, ServiceEndpoint, false, false);

            // Process response
            AnyCheckResponseDataContractSerializer respDcs;
            respDcs = new AnyCheckResponseDataContractSerializer("AnyCheckResponse", "http://schemas.example.org/SimpleService");
            AnyCheckResponse resp;
            resp = ((AnyCheckResponse)(respDcs.ReadObject(response.Reader)));
            return resp;
        }
开发者ID:meikeric,项目名称:DotCopter,代码行数:28,代码来源:SimpleServiceClientProxy.cs


示例13: ParseSoapMessage

        public static XmlReader ParseSoapMessage(byte[] soapMessage, out WsWsaHeader header)
        {
            MemoryStream requestStream = new MemoryStream(soapMessage);
            XmlReader reader = XmlReader.Create(requestStream);
            header = new WsWsaHeader();

            try
            {
                reader.ReadStartElement("Envelope", WsWellKnownUri.SoapNamespaceUri);
#if DEBUG
                int depth = reader.Depth;
#endif
                header.ParseHeader(reader);
#if DEBUG
                Microsoft.SPOT.Debug.Assert(XmlReaderHelper.HasReadCompleteNode(depth, reader));
#endif
                reader.ReadStartElement("Body", WsWellKnownUri.SoapNamespaceUri);

            }
            catch (XmlException e)
            {
                reader.Close();
                throw new WsFaultException(header, WsFaultType.XmlException, e.ToString());
            }

            return reader;
        }
开发者ID:prabby,项目名称:miniclr,代码行数:27,代码来源:WsUtilities.cs


示例14: WsMessage

 public WsMessage( WsWsaHeader header, object body, WsPrefix prefixes, WsXmlNamespaces namespaces, WsAppSequence appSequence)
 {
     this.Header      = header;
     this.Body        = body;
     this.Prefixes    = prefixes;
     this.Namespaces  = namespaces;
     this.AppSequence = appSequence;
 }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:8,代码来源:WsSoapDispatcher.cs


示例15: TwoWayResponse

        public byte[] TwoWayResponse(WsWsaHeader header, int sum)
        {
            MemoryStream soapStream = new MemoryStream();
            XmlWriter xmlWriter = XmlWriter.Create(soapStream);

            // Write processing instructions and root element
            xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
            xmlWriter.WriteStartElement("soap", "Envelope", 
                "http://www.w3.org/2003/05/soap-envelope");

            // Write namespaces
            xmlWriter.WriteAttributeString("xmlns", "wsdp", null, 
                Device.Namespaces.GetNamespace("wsdp"));
            xmlWriter.WriteAttributeString("xmlns", "wsd", null, 
                Device.Namespaces.GetNamespace("wsd"));
            xmlWriter.WriteAttributeString("xmlns", "wsa", null, 
                Device.Namespaces.GetNamespace("wsa"));
            xmlWriter.WriteAttributeString("xmlns", "sim", null, 
                TypeNamespaces.GetNamespace("sim"));

            // Write header
            xmlWriter.WriteStartElement("soap", "Header", null);
            xmlWriter.WriteStartElement("wsa", "To", null);
            xmlWriter.WriteString(header.From);
            xmlWriter.WriteEndElement();
            xmlWriter.WriteStartElement("wsa", "Action", null);
            xmlWriter.WriteString("http://schemas.example.org/SimpleService/TwoWayResponse");
            xmlWriter.WriteEndElement();
            xmlWriter.WriteStartElement("wsa", "RelatesTo", null);
            xmlWriter.WriteString(header.MessageID);
            xmlWriter.WriteEndElement(); // End RelatesTo
            xmlWriter.WriteStartElement("wsa", "MessageID", null);
            xmlWriter.WriteString("urn:uuid:" + Device.GetUuid());
            xmlWriter.WriteEndElement(); // End MessageID
            xmlWriter.WriteEndElement(); // End Header

            // write body
            xmlWriter.WriteStartElement("soap", "Body", null);
            xmlWriter.WriteStartElement("sim", "TwoWayResponse", null);
            xmlWriter.WriteStartElement("sim", "Sum", null);
            xmlWriter.WriteString(sum.ToString());
            xmlWriter.WriteEndElement(); // End Sun
            xmlWriter.WriteEndElement(); // End TwoWayResponse
            xmlWriter.WriteEndElement(); // End Body

            xmlWriter.WriteEndElement();

            // Create return buffer and close writer
            xmlWriter.Flush();
            byte[] soapBuffer = soapStream.ToArray();
            xmlWriter.Close();

            return soapBuffer;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:54,代码来源:TestService.cs


示例16: MyOneWayOperation

        public byte[] MyOneWayOperation(WsWsaHeader header, XmlReader reader)
        {
            reader.ReadStartElement("MyOneWayRequest", this.ServiceNamespace.NamespaceURI);

            // Extract parameter A from SOAP message body
            string str = reader.ReadElementString("A", this.ServiceNamespace.NamespaceURI);
            int a = Convert.ToInt32(str);

            Debug.Print("MyOneWayOperation with A=" + a + " executed.");
            return null; // No response it is a one-way operation
        }
开发者ID:meikeric,项目名称:DotCopter,代码行数:11,代码来源:OneWayOperationService.cs


示例17: FireSimpleEvent

 public void FireSimpleEvent(int a)
 {
     DpwsWseEventSource eventSource = this.EventSources["SimpleEvent"];
     WsWsaHeader header = new WsWsaHeader(c_namespaceUri + "/SimpleEvent", null, null, null, null, null);
     Device.SubscriptionManager.FireEvent(this, // hosted service
                                          eventSource,
                                          header,
                                          BuildSimpleEventMessageBody(a)
                                          );
     Debug.Print("Simple event was fired with param a=" + a + ".");
 }
开发者ID:meikeric,项目名称:DotCopter,代码行数:11,代码来源:EventingService.cs


示例18: 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


示例19: SimpleEvent

        private byte[] SimpleEvent(WsWsaHeader header, XmlReader reader)
        {
            reader.ReadStartElement("SimpleEvent", c_namespaceUri);

            // Extract parameter Quotient from SOAP message body
            string str = reader.ReadElementString("A", c_namespaceUri);
            int a = Convert.ToInt32(str);
            Debug.Print("Simple event notification was received with A=" +
                        a + ".");

            // Event handlers provide no response (but do not return null).
            return new byte[0];
        }
开发者ID:brandongrossutti,项目名称:DotCopter,代码行数:13,代码来源:EventingServiceController.cs


示例20: OneWay

        public virtual Byte[] OneWay(WsWsaHeader header, XmlReader reader)
        {
            // Build request object
            OneWayDataContractSerializer reqDcs;
            reqDcs = new OneWayDataContractSerializer("OneWay", "http://schemas.example.org/SimpleService");
            OneWay req;
            req = ((OneWay)(reqDcs.ReadObject(reader)));

            // Call service operation to process request.
            m_service.OneWay(req);

            // Return null response for oneway messages
            return null;
        }
开发者ID:brandongrossutti,项目名称:DotCopter,代码行数:14,代码来源:SimpleServiceHostedService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.Engine类代码示例发布时间:2022-05-26
下一篇:
C# Soap.WsMessage类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap