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


C# WsaAddressing.WsWsaHeader类代码示例

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


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


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