public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { var buffer = request.CreateBufferedCopy(int.MaxValue); request = buffer.CreateMessage(); using Stream mStream = new MemoryStream(); using var xmlWriter = XmlWriter.Create(mStream); buffer.CreateMessage().WriteMessage(xmlWriter); xmlWriter.Flush(); mStream.Position = 0; _requestLength = mStream.Length; var xml = new byte[mStream.Length]; mStream.Read(xml, 0, (int)mStream.Length); if (xml[0] != (byte)'<') { _requestStr = Encoding.UTF8.GetString(xml, 3, xml.Length - 3); } else { _requestStr = Encoding.UTF8.GetString(xml, 0, xml.Length); } ; ; return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { if (_userName != null) { var nameHeader = MessageHeader.CreateHeader("UserName", "Authentication", _userName); if (request.Headers.FindHeader("UserName", "Authentication") <= 0) { request.Headers.Add(nameHeader); } } if (_userPassword != null) { var passwordHeader = MessageHeader.CreateHeader("UserPassword", "Authentication", _userPassword); if (request.Headers.FindHeader("UserPassword", "Authentication") <= 0) { request.Headers.Add(passwordHeader); } } if (_customerId != null) { var idHeader = MessageHeader.CreateHeader("CustomerId", "Authentication", _customerId); if (request.Headers.FindHeader("CustomerId", "Authentication") <= 0) { request.Headers.Add(idHeader); } } var clientApplicationTypeHeader = MessageHeader.CreateHeader("ClientApplicationType", "Authentication", 3); if (request.Headers.FindHeader("ClientApplicationType", "Authentication") <= 0) { request.Headers.Add(clientApplicationTypeHeader); } return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { UsernameToken token = new UsernameToken(Username, Password, PasswordOption.SendPlainText); XmlElement securityToken = token.GetXml(new XmlDocument()); // Modificamos el XML Generado. // var nodo = securityToken.GetElementsByTagName("wsse:Nonce").Item(0); //nodo?.RemoveAll(); MessageHeader securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", securityToken, false); request.Headers.Add(securityHeader); MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue); request = buffer.CreateMessage(); try { System.IO.File.WriteAllText(@"c:\temp\" + DateTime.Now.ToString("MMddyyyyhhmmssfff") + ".xml", request.ToString()); } catch { } return(Convert.DBNull); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { LastRequestXML = request.ToString(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(LastRequestXML); XmlHelpers.AddNamespacesToEnvelope(xmlDoc); XmlHelpers.AddNamespaceToBody(xmlDoc); XmlHelpers.AddTimestamp(xmlDoc); string id1 = XmlHelpers.AddIDToElement(xmlDoc, "Body", "http://www.w3.org/2003/05/soap-envelope", "DB-1"); XmlHelpers.ReplaceIdWithNamespaceId(xmlDoc); _signXml.AddSignature(xmlDoc, "#" + id1); _encryptXml.EncryptBody(xmlDoc); string id2 = XmlHelpers.AddIDToElement(xmlDoc, "EncryptedData", "http://www.w3.org/2001/04/xmlenc#", "DB-2"); _signXml.AddSignature(xmlDoc, "#" + id2); using (StringWriter stringWriter = new StringWriter()) using (var xmlTextWriter = XmlWriter.Create(stringWriter)) { xmlDoc.WriteTo(xmlTextWriter); xmlTextWriter.Flush(); var result = stringWriter.GetStringBuilder().ToString(); request = ChangeString(request, result); return(request); } }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { var buffer = request.CreateBufferedCopy(Int32.MaxValue); request = buffer.CreateMessage(); LogMessage(buffer, true); return(request); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { request.Headers.Add(MessageHeader.CreateHeader("Passport", "ms", PassportTicket)); #if PASSPORT_HEADER_ANALYSIS Traces.WebService_TraceEvent(TraceEventType.Information, 2, request.ToString()); #endif return(null); }
/// <summary> /// Called after an inbound message has been received but /// before the message is dispatched to the intended operation. /// /// This method will also raise RaiseRequestReceived event. /// </summary> /// <param name="request">The request message.</param> /// <param name="channel">The incoming channel.</param> /// <param name="instanceContext">The current service instance.</param> /// <returns> /// The object used to correlate state. /// </returns> public object AfterReceiveRequest( ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext) { Request = request.ToString(); OnRaiseRequestReceived(Request); return(null); }
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message message, System.ServiceModel.IClientChannel channel) { // here we can finally access the XML by the overloaded ``.ToString``-method if (SoapXmlRequestOccured != null) { SoapXmlRequestOccured(this, new StringEventArgs(message.ToString())); } return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { string encoded = Convert.ToBase64String((Username + ":" + Password).ToUtf8()); var httpRequestMessage = new HttpRequestMessageProperty(); httpRequestMessage.Headers.Add("Authorization", "Basic " + encoded); request.Properties.Add(HttpRequestMessageProperty.Name, httpRequestMessage); return(Convert.DBNull); }
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel) { if (authToken != null) { var reqMsgProperty = new HttpRequestMessageProperty(); reqMsgProperty.Headers.Add("Auth-token", authToken); request.Properties[HttpRequestMessageProperty.Name] = reqMsgProperty; } return(null); }
public object AfterReceiveRequest(ref Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext) { try { var membershipProvider = InstanceProvider.Container.Resolve <IMembershipProvider>(); int userNameHeaderIndex = request.Headers.FindHeader("UserName", "Authentication"); var passwordHeaderIndex = request.Headers.FindHeader("UserPassword", "Authentication"); var customerIdHeader = request.Headers.FindHeader("CustomerId", "Authentication"); var clientApplicationTypeHeader = request.Headers.FindHeader("ClientApplicationType", "Authentication"); var hasLoginInfo = userNameHeaderIndex >= 1 && passwordHeaderIndex >= 1; var customerId = request.Headers.GetHeader <string>(customerIdHeader); if ((!hasLoginInfo && _validateUserLogin) || !(customerIdHeader >= 1) || !(clientApplicationTypeHeader >= 1)) { throw new ArgumentException("Invalid headers"); } #if !DEBUG Membership.ApplicationName = customerId; Roles.ApplicationName = customerId; #endif if (_validateUserLogin) { var userName = request.Headers.GetHeader <string>(userNameHeaderIndex); var userPassword = request.Headers.GetHeader <string>(passwordHeaderIndex); if (!membershipProvider.ValidateUser(userName, userPassword)) { throw new Exception("Invalid user: "******"Invalid customer: " + customerId); } TenantConnectionProvider.DynamicString = conn; TenantConnectionProvider.ApplicationType = Int32.Parse(clientApplicationType); } catch (Exception ex) { Log.Info(ex); request = null; throw; } return(null); }
//server public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext) { var requestDetails = request; var channelDetails = channel; var instanceContextDetails = instanceContext; return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { UsernameToken token = new UsernameToken(this.Username, this.Password, PasswordOption.SendHashed); XmlElement securityToken = token.GetXml(new XmlDocument()); MessageHeader securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", securityToken, false); request.Headers.Add(securityHeader); return(Convert.DBNull); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { if (_sessionID != null && _sessionID != Guid.Empty) { var sessionHeader = new SessionInfoHeader() { SessionId = _sessionID, EpicorUserId = _epicorUserId }; request.Headers.Add(sessionHeader); } return(request); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { foreach (var kv in _defaultHeaderValue) { if (request.Headers.FindHeader(kv.Key, Constants.Namespace) == -1) { request.Headers.Add(MessageHeader.CreateHeader(kv.Key, Constants.Namespace, kv.Value)); } } return(null); }
public object AfterReceiveRequest(ref Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext) { var messageProperty = (HttpRequestMessageProperty) OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name]; string cookie = messageProperty.Headers.Get("Set-Cookie"); if (cookie == null) // Check for another Message Header - SL applications { cookie = messageProperty.Headers.Get("Cookie"); } if (cookie == null) cookie = string.Empty; //You can get the credentials from here, do something to them, on the service side }
/// <summary> /// Called after an inbound message has been received but /// before the message is dispatched to the intended operation. /// /// This method will also raise RaiseRequestReceived event. /// </summary> /// <param name="request">The request message.</param> /// <param name="channel">The incoming channel.</param> /// <param name="instanceContext">The current service instance.</param> /// <returns> /// The object used to correlate state. /// </returns> public object AfterReceiveRequest( ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext) { // Request wordt bij sommige calls (bij afspelen van fragment de calls die info ophalen) // gedisposed tussen 'AfterReceiveRequest' en 'BeforeSendReply' // daarom aangepast en hier al de gegevens gevuld en dat als parameter teruggegeven InspectorEventArgs message = new InspectorEventArgs(); try { message.TimeStamp = DateTime.Now; message.Message = request.Headers.To.PathAndQuery; message.Request = request.Headers.To.PathAndQuery; message.Username = Username; message.ClientIP = CDR.WebService.ServiceHelper.CurrentClientIP; message.Servername = System.ServiceModel.OperationContext.Current.Channel.LocalAddress.Uri.Host; message.LocalIP = "127.0.0.1"; // weet niet hoe ik hieraan moet komen en ip opvragen via OS heeft dan ook geen zin message.Method = System.ServiceModel.Web.WebOperationContext.Current.IncomingRequest.Method; message.Referer = System.ServiceModel.Web.WebOperationContext.Current.IncomingRequest.Headers["Referer"] ?? ""; message.Cookie = System.ServiceModel.Web.WebOperationContext.Current.IncomingRequest.Headers["Cookie"] ?? ""; message.UserAgent = System.ServiceModel.Web.WebOperationContext.Current.IncomingRequest.UserAgent; // Zie http://archive.cnblogs.com/a/1669283/ message.FunctionName = string.Empty; string key = WebHttpDispatchOperationSelector.HttpOperationSelectorUriMatchedPropertyName; var props = System.ServiceModel.OperationContext.Current.IncomingMessageProperties; UriTemplateMatch match = null; if (props.ContainsKey(key) && (bool)props[key]) { match = System.ServiceModel.OperationContext.Current.IncomingMessageProperties["UriTemplateMatchResults"] as UriTemplateMatch; // Waarschijnlijk is na .net 2.0 dit veld in een string veranderd en makkelijk uit te lezen?!? if (match.Data is string) { message.FunctionName = (string)match.Data; } else { message.FunctionName = getOperationName(match.Data); } } } catch (Exception e) { message.Message = e.Message; } return(message); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <param name="channel"></param> /// <param name="instanceContext"></param> /// <returns></returns> public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext) { if (Enabled && !String.IsNullOrEmpty(request.ToString())) { _request = request.ToString(); //LogHelper.AddTrace(Messages.ServicioIncidenciaTrace, _identificador, request.ToString(), String.Empty); } else { _request = string.Empty; } return(null); }
/// <summary> /// Adds headers /// </summary> /// <param name="request"></param> /// <param name="channel"></param> /// <returns></returns> public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { if (_endpointReference != null && _endpointReference.ReferenceParameters != null) { if (_endpointReference.ReferenceParameters.Any != null) { foreach (XmlElement element in _endpointReference.ReferenceParameters.Any) { request.Headers.Add(new SubscriptionReferenceHeader(element)); } } } return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { int limit = request.Headers.Count; for (int i = 0; i < limit; ++i) { if (request.Headers[i].Name.Equals("VsDebuggerCausalityData")) { request.Headers.RemoveAt(i); break; } } return(request); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { DateTime created = DateTime.Now; string createdString = created.ToString("yyyy-MM-ddTHH:mm:ss.fff-05:00"); var envelope = new XmlDocument(); XmlNode securityNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); XmlNode usernameTokenNode = envelope.CreateNode(XmlNodeType.Element, "wsse:UsernameToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); XmlElement userElement = usernameTokenNode as XmlElement; userElement.SetAttribute("xmlns:wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); XmlNode userNameNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Username", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); userNameNode.InnerXml = Username; XmlNode pwdNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Password", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); XmlElement pwdElement = pwdNode as XmlElement; pwdElement.SetAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); pwdNode.InnerXml = SHA256Hash(Password).ToLower(); XmlNode nonceNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Nonce", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); XmlElement nonceElement = nonceNode as XmlElement; nonceElement.SetAttribute("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"); nonceNode.InnerXml = System.Convert.ToBase64String(Encoding.UTF8.GetBytes(DateTime.Now.ToBinary().ToString())); XmlNode createNode = envelope.CreateNode(XmlNodeType.Element, "wsu", "Created", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); XmlElement createElement = createNode as XmlElement; createNode.InnerXml = createdString; usernameTokenNode.AppendChild(userNameNode); usernameTokenNode.AppendChild(pwdNode); usernameTokenNode.AppendChild(nonceNode); usernameTokenNode.AppendChild(createNode); //securityNode.AppendChild(usernameTokenNode); var securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", usernameTokenNode); request.Headers.Add(securityHeader); return(Convert.DBNull); }
/// <summary> /// The before send request. /// </summary> /// <param name="request">The request.</param> /// <param name="channel">The channel.</param> /// <returns> /// The <see cref="object" />. /// </returns> public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { // Use the WSE 3.0 security token class var token = new UsernameToken(this.Username, this.Password, PasswordOption.SendHashed); // Serialize the token to XML var securityToken = token.GetXml(new XmlDocument()); // build the security header var securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", securityToken, false); request.Headers.Add(securityHeader); // complete return(Convert.DBNull); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { if (OnMessageInspected != null) { // Notify the subscribers of the inpected message. OnMessageInspected(this, new MessageInspectorArgs { Message = request.ToString(), MessageInspectionType = EMessageInspectionType.Request }); } MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue); request = buffer.CreateMessage(); //Console.WriteLine("Received:\n{0}", buffer.CreateMessage().ToString()); return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { //var token = new UsernameToken(Username, Password, PasswordOption.SendPlainText); //var securityToken = token.GetXml(new XmlDocument()); //// Modificamos el XML Generado. //var nodo = securityToken.GetElementsByTagName("wsse:Nonce").Item(0); //nodo?.RemoveAll(); //var securityHeader = MessageHeader.CreateHeader("Security", // EspacioNombres.wssecurity, // securityToken, false); //request.Headers.Add(securityHeader); return(Convert.DBNull); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { object obj; if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out obj)) { var httpRequestMsg = obj as HttpRequestMessageProperty; SetRequestCookies(channel, httpRequestMsg); } else { var httpRequestMsg = new HttpRequestMessageProperty(); SetRequestCookies(channel, httpRequestMsg); request.Properties.Add(HttpRequestMessageProperty.Name, httpRequestMsg); } return(channel.RemoteAddress.Uri); }
/// <summary> /// Enables inspection or modification of a message before a request message is sent to a service. /// </summary> /// <param name="request">The message to be sent to the service.</param> /// <param name="channel">The WCF client object channel.</param> /// <returns>The object that is returned as the <paramref name="correlationState " />argument of the <see cref="M:System.ServiceModel.Dispatcher.IClientMessageInspector.AfterReceiveReply(System.ServiceModel.Channels.Message@,System.Object)" /> method. This is null if no correlation state is used.The best practice is to make this a <see cref="T:System.Guid" /> to ensure that no two <paramref name="correlationState" /> objects are the same.</returns> public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { HttpRequestMessageProperty httpRequest; if (request.Properties.ContainsKey(HttpRequestMessageProperty.Name)) { httpRequest = request.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty; } else { httpRequest = new HttpRequestMessageProperty(); request.Properties.Add(HttpRequestMessageProperty.Name, httpRequest); } string WulkaaBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}", UserName, Password))); httpRequest.Headers["Authorization"] = string.Format("Wulkaa {0}", WulkaaBase64); return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { UsernameToken token = new UsernameToken(Username, Password, PasswordOption.SendPlainText); XmlElement securityToken = token.GetXml(new XmlDocument()); // Modificamos el XML Generado. var nodo = securityToken.GetElementsByTagName("wsse:Nonce").Item(0); nodo?.RemoveAll(); MessageHeader securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", securityToken, false); request.Headers.Add(securityHeader); return(Convert.DBNull); }
/// <summary> /// Enables inspection or modification of a message before a request message is sent to a service. /// </summary> /// <param name="request">The message to be sent to the service.</param> /// <param name="channel">The client object channel.</param> /// <returns> /// The object that is returned as the <paramref name="correlationState "/>argument of the <see cref="M:System.ServiceModel.Dispatcher.IClientMessageInspector.AfterReceiveReply(System.ServiceModel.Channels.Message@,System.Object)"/> method. This is null if no correlation state is used.The best practice is to make this a <see cref="T:System.Guid"/> to ensure that no two <paramref name="correlationState"/> objects are the same. /// </returns> public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { HttpRequestMessageProperty httpRequest; if (request.Properties.ContainsKey(HttpRequestMessageProperty.Name)) { httpRequest = request.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty; } else { httpRequest = new HttpRequestMessageProperty(); request.Properties.Add(HttpRequestMessageProperty.Name, httpRequest); } string hash = Convert.ToBase64String(new HMACSHA256(Encoding.UTF8.GetBytes(UserName)).ComputeHash(Encoding.UTF8.GetBytes(string.Format("{0}{1}", UserName, Session)))); httpRequest.Headers["Authorization"] = string.Format("Wulkaas {0}:{1}", Session, hash); return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { string created = DateTime.UtcNow.AddSeconds(0 - _timeOffset) .ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture) + "Z"; // string created = DateTime.UtcNow.AddHours(1) // .ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture) + "Z"; byte[] b = new byte[20]; new Random().NextBytes(b); byte[] digestbuf = new byte[b.Length + Encoding.UTF8.GetByteCount(created + Password)]; b.CopyTo(digestbuf, 0); Encoding.UTF8.GetBytes(created + Password).CopyTo(digestbuf, b.Length); SHA1 sha1 = SHA1.Create(); string digest = Convert.ToBase64String(sha1.ComputeHash(digestbuf)); string xml = string.Format(XMLAuth, Username, digest, Convert.ToBase64String(b), created, Namespace); var token = GetElement(xml); MessageHeader securityHeader = MessageHeader.CreateHeader("Security", Namespace, token, true); request.Headers.Add(securityHeader); int limit = request.Headers.Count; for (int i = 0; i < limit; ++i) { //remove the debugger xml packet if (request.Headers[i].Name.Equals("VsDebuggerCausalityData")) { request.Headers.RemoveAt(i); break; } } // complete // return Convert.DBNull; return(null); }
public object BeforeSendRequest(ref Message request, System.ServiceModel.IClientChannel channel) { var utf8 = Encoding.UTF8; String usernameandPW = Username + ":" + Password; byte[] utfBytes = utf8.GetBytes(usernameandPW); // string encoded = Convert.ToBase64String((Username + ":" + Password).ToUtf8()); string encoded = Convert.ToBase64String(utfBytes); var httpRequestMessage = new HttpRequestMessageProperty(); // httpRequestMessage.Headers.Add("Authorization", "Basic " + encoded); httpRequestMessage.Headers["Authorization"] = "Basic " + encoded; // httpRequestMessage.Headers.Add("Authorization", "Basic " + encoded); request.Properties.Add(HttpRequestMessageProperty.Name, httpRequestMessage); // return Convert.DBNull; return(null); }