コード例 #1
0
        /// <summary>
        /// Make a soap request.
        /// </summary>
        /// <param name="body">formatted xml body.</param>
        /// <returns>the response string from service.</returns>
        private string MakeRequest(XElement body)
        {
            try
            {
                SoapClient  client = new SoapClient(HttpClientFactory);
                XmlDocument header = new XmlDocument();

                header.LoadXml(Auth.AsSoapHeader());

                HttpResponseMessage message = client.Post(
                    new Uri(location),
                    SoapVersion.Soap12,
                    body: body,
                    header: header);

                return(message.Content.ReadAsStringAsync().Result);
            }
            catch (Exception exeption)
            {
                return(new JObject
                {
                    {
                        "status", new JObject
                        {
                            { "status", Status.ST_ERROR },
                            { "reason", "WR" },
                            { "message", PlacetoPayException.ReadException(exeption) },
                            { "date", (DateTime.Now).ToString("yyyy-MM-ddTHH\\:mm\\:sszzz") },
                        }
                    },
                }.ToString());
            }
        }