Exemplo n.º 1
0
        public void BeforeSerialize(SoapMessage message)         //ObjectOut
        {
            if (System.Environment.OSVersion.Platform != PlatformID.WinCE)
            {
                //NOTE this only works if you handle StreamOut/In too
                //NOTE this only works on .NETfx
                TimestampHeader timestampHeader = new TimestampHeader(300);
                message.Headers.Add(timestampHeader);

                //if(EndPoint == EndPointType.Addressing)
                ActionHeader actionHeader = new ActionHeader(message.Action);
                //FromHeader fromHeader = new FromHeader(null);
                ReplyToHeader   replyToHeader   = new ReplyToHeader(null);
                MessageIdHeader messageIdHeader = new MessageIdHeader(null);
                ToHeader        toHeader        = new ToHeader(message.Url);
                message.Headers.Add(actionHeader);
                //message.Headers.Add(fromHeader);
                message.Headers.Add(replyToHeader);
                message.Headers.Add(messageIdHeader);
                message.Headers.Add(toHeader);
                //else //routing
                //pathHeader pHeader = new pathHeader(message.Action, message.Url, null);
                //message.Headers.Add(pHeader);
            }
            return;
        }
Exemplo n.º 2
0
 public void BeforeSerialize(SoapMessage message)         //ObjectOut
 {
     if (onClientOrServer == OnClientOrServer.Unknown)
     {
         onClientOrServer = OnClientOrServer.Client;
     }
     if (System.Environment.OSVersion.Platform != PlatformID.WinCE)
     {
         //NOTE this only works if you handle StreamOut/In too
         //NOTE this only works on .NETfx
         //TimestampHeader timestampHeader = new TimestampHeader(300);
         //message.Headers.Add(timestampHeader);
         if (onClientOrServer == OnClientOrServer.Server)
         {
             ActionHeader actionHeader = new ActionHeader(message.Action + "Response");
             //else check what the inAction is
             RelatesToHeader relatesToHeader = null;
             if (inMessageId != null)
             {
                 relatesToHeader = new RelatesToHeader(inMessageId);
             }
             ToHeader toHeader = null;
             if (inReplyTo != null)
             {
                 toHeader = new ToHeader(inReplyTo);
             }
             //TODO ReferenceProperties
             message.Headers.Add(actionHeader);
             if (relatesToHeader != null)
             {
                 message.Headers.Add(relatesToHeader);
             }
             if (toHeader != null)
             {
                 message.Headers.Add(toHeader);
             }
         }
         else
         {
             //if(EndPoint == EndPointType.Addressing)
             ActionHeader    actionHeader    = new ActionHeader(message.Action);
             FromHeader      fromHeader      = new FromHeader(null);
             MessageIdHeader messageIdHeader = new MessageIdHeader(null);
             ToHeader        toHeader        = new ToHeader(message.Url);
             //TODO Subscription would need a ReplyTo header for asynch web services
             //ReplyToHeader replyToHeader = new ReplyToHeader("http://tempuri.org/RespondToClientCall/");
             ReplyToHeader replyToHeader = new ReplyToHeader(message.Url);                     //just respond normally?
             message.Headers.Add(replyToHeader);
             message.Headers.Add(actionHeader);
             message.Headers.Add(fromHeader);
             message.Headers.Add(messageIdHeader);
             message.Headers.Add(toHeader);
         }
         //else //routing
         //pathHeader pHeader = new pathHeader(message.Action, message.Url, null);
         //message.Headers.Add(pHeader);
     }
     return;
 }
Exemplo n.º 3
0
 public void AfterDeserialize(SoapMessage message)         //ObjectIn
 {
     if (onClientOrServer == OnClientOrServer.Unknown)
     {
         onClientOrServer = OnClientOrServer.Server;
     }
     if (onClientOrServer == OnClientOrServer.Server)
     {
         foreach (SoapHeader sh in message.Headers)
         {
             //TODO check for SubscriptionEnd header for WS-Addressing
             if (sh is SoapUnknownHeader)
             {
                 SoapUnknownHeader suh = (SoapUnknownHeader)sh;
                 if (suh.Element.LocalName == "Action")
                 {
                     inAction = suh.Element.InnerText;
                 }
                 if (suh.Element.LocalName == "MessageID")
                 {
                     inMessageId = suh.Element.InnerText;
                 }
                 if (suh.Element.LocalName == "ReplyTo")
                 {
                     inReplyTo = suh.Element.FirstChild.InnerText;
                 }
                 if (suh.Element.LocalName == "SubscriptionEnd")
                 {
                     subscriptionEnd = suh.Element;
                 }
             }
             if (sh is ActionHeader)
             {
                 ActionHeader ah = (ActionHeader)sh;
                 inAction = ah.text;
             }
             if (sh is MessageIdHeader)
             {
                 MessageIdHeader mih = (MessageIdHeader)sh;
                 inMessageId = mih.text;
             }
             if (sh is ReplyToHeader)
             {
                 ReplyToHeader rth = (ReplyToHeader)sh;
                 inReplyTo = rth.Address.text;
             }
         }
     }
     else             //client
     {
     }
     return;
 }