{"id":6915,"date":"2022-02-19T03:56:17","date_gmt":"2022-02-18T18:56:17","guid":{"rendered":"https:\/\/www.auctionpro.co.kr\/?p=6915"},"modified":"2026-04-02T14:58:01","modified_gmt":"2026-04-02T05:58:01","slug":"soap-xml-%ec%a1%b0%ed%9a%8c-%ec%bd%94%ec%96%b4","status":"publish","type":"post","link":"https:\/\/www.auctionpro.co.kr\/?p=6915","title":{"rendered":"Soap XML, Json \uc6f9\uc11c\ube44\uc2a4"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Remark :  Soap xml \uc744 \uc870\ud68c\ud558\ub294 \uc6f9\uc11c\ube44\uc2a4\ub97c \ub9cc\ub4e4\uc5b4 \ubcf4\uc790<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SoapWebservice.png\"><img loading=\"lazy\" decoding=\"async\" width=\"302\" height=\"437\" src=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SoapWebservice.png\" alt=\"\" class=\"wp-image-6916\" srcset=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SoapWebservice.png 302w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SoapWebservice-207x300.png 207w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SoapWebservice-104x150.png 104w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><\/a><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"Service.asmx\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Services;\nusing System.Xml;\n\nnamespace SoapTest\n{\n    \/\/\/ &lt;summary&gt;\n    \/\/\/ Service1\uc758 \uc694\uc57d \uc124\uba85\uc785\ub2c8\ub2e4.\n    \/\/\/ &lt;\/summary&gt;\n    [WebService(Namespace = \"http:\/\/tempuri.org\/\")]\n    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]\n    [System.ComponentModel.ToolboxItem(false)]\n    \/\/ ASP.NET AJAX\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc2a4\ud06c\ub9bd\ud2b8\uc5d0\uc11c \uc774 \uc6f9 \uc11c\ube44\uc2a4\ub97c \ud638\ucd9c\ud558\ub824\uba74 \ub2e4\uc74c \uc904\uc758 \uc8fc\uc11d \ucc98\ub9ac\ub97c \uc81c\uac70\ud569\ub2c8\ub2e4. \n    \/\/ [System.Web.Script.Services.ScriptService]\n    public class Service1 : System.Web.Services.WebService\n    {\n        \/\/******************************************************************************\n        \/\/ \ud568\uc218\uba85    : Function\n        \/\/ \uc791\uc131\uc790    : ***\n        \/\/ \uc791\uc131\uc77c    : 2022-02-11\n        \/\/ \uc124\uba85      :  Soap \uc870\ud68c\uac04\ub2e8 \ud14c\uc2a4\ud2b8\n        \/\/ \ub9ac\ud134\uac12    : \n        \/\/ \ub9e4\uac1c\ubcc0\uc218  :\n        \/\/ Remark    : \n        \/\/ \uc774\ub825\uc0ac\ud56d  : \n        \/\/******************************************************************************\n\n        [WebMethod]\n        public XmlElement uAPITest(string ServiceName, string SoapRequest)\n        {\n            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls12;\n\n            string EndPoint = \"https:\/\/*****.**.\/Soap\/\" + ServiceName;\n            string credentials = \"**************\";\n            string Password = \"******\/\";\n\n            string Res = string.Empty;\n\n            try\n            {\n                SoapClass SC = new SoapClass();\n                Res = SC.CallWebService(1, EndPoint, SoapRequest, credentials, Password);\n                SC = null;\n            }\n            catch(Exception ex)\n            {\n                Res = ex.Message.ToString();\n                Res = \"&lt;ERR&gt;\" + Res + \"&lt;\/ERR&gt;\";\n\n            }\n\n            XmlDocument doc = new XmlDocument();\n            doc.LoadXml(Res);\n            return doc.DocumentElement;\n        }\n    }\n}<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"SoapClass\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Web;\nusing System.Xml;\nusing System.Net;\nusing System.IO;\n\nnamespace SoapTest\n{\n    public class SoapClass\n    {\n        public string CallWebService(int ServerType, string EndPoint, string SoapData, string credentials, string Password)\n        {\n            var _action = EndPoint;\n\n            XmlDocument soapEnvelopeXml = CreateSoapEnvelope(SoapData);\n            HttpWebRequest webRequest = CreateWebRequest(ServerType, _action, credentials, Password);\n            InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest);\n\n            \/\/ begin async call to web request.\n            IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null);\n\n            \/\/ suspend this thread until call is complete. You might want to\n            \/\/ do something usefull here like update your UI.\n            asyncResult.AsyncWaitHandle.WaitOne(); \/\/\uc8fc\uc11d\ucc98\ub9ac\n\n            \/\/ get the response from the completed web request.\n            string soapResult;\n            using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult))\n            {\n                using (StreamReader rd = new StreamReader(webResponse.GetResponseStream()))\n                {\n                    soapResult = rd.ReadToEnd();\n                }\n            }\n            return soapResult;\n        }\n\n        private HttpWebRequest CreateWebRequest(int ServerType, string action, string credentials, string Password)\n        {\n\n            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(action); \/\/action \uc0ac\uc6a9\n            \/\/webRequest.Headers.Add(\"SOAPAction\", action); \/\/\uc544\ub798\uc544 \uac19\uc774 \uc218\uc815 \n            webRequest.Headers.Add(\"Authorization\", \"Basic \" + Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials + \":\" + Password)));\n            webRequest.ContentType = \"text\/xml;charset=\\\"utf-8\\\"\";\n            webRequest.Accept = \"text\/xml\";\n            webRequest.Method = \"POST\";\n\n            return webRequest;\n        }\n\n        private XmlDocument CreateSoapEnvelope(string SoapData)\n        {\n            XmlDocument soapEnvelop = new XmlDocument();\n            soapEnvelop.LoadXml(SoapData);\n            return soapEnvelop;\n        }\n\n        private void InsertSoapEnvelopeIntoWebRequest(XmlDocument soapEnvelopeXml, HttpWebRequest webRequest)\n        {\n            using (Stream stream = webRequest.GetRequestStream())\n            {\n                soapEnvelopeXml.Save(stream);\n            }\n        }\n\n    }\n}<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Json \ub9ac\ud134  Sample<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"JsonSample \" >using System.Web.Script.Serialization;\nusing System.Web.Script.Services;\nusing System.Web.Services;\n\/\/using System.Web;\nusing Newtonsoft.Json;\n\nnamespace WcfService1\n{\n    \/\/\/ &lt;summary&gt;\n    \/\/\/ WebService1\uc758 \uc694\uc57d \uc124\uba85\uc785\ub2c8\ub2e4.\n    \/\/\/ &lt;\/summary&gt;\n    [WebService(Namespace = \"http:\/\/tempuri.org\/\")]\n    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]\n    [System.ComponentModel.ToolboxItem(false)]\n    \/\/ ASP.NET AJAX\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc2a4\ud06c\ub9bd\ud2b8\uc5d0\uc11c \uc774 \uc6f9 \uc11c\ube44\uc2a4\ub97c \ud638\ucd9c\ud558\ub824\uba74 \ub2e4\uc74c \uc904\uc758 \uc8fc\uc11d \ucc98\ub9ac\ub97c \uc81c\uac70\ud569\ub2c8\ub2e4. \n    [System.Web.Script.Services.ScriptService]\n    public class WebService1 : System.Web.Services.WebService\n    {\n        static string JsonSample = \"https:\/\/data.auctionpro.co.kr\/JsonSample\";\n\n        [WebMethod]\n        [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]\n        public void Hello()\n        {   \n            string resultJson = string.Empty;\n\n            string sParameter = @\"?param=test\";\n\n            resultJson = WebSend.JsonSend(JsonSample +  sParameter);\n\n            string sContent = JsonConvert.SerializeObject(JsonConvert.DeserializeObject&lt;object&gt;(resultJson), Newtonsoft.Json.Formatting.Indented);\n\n            JavaScriptSerializer js = new JavaScriptSerializer();\n            Context.Response.Clear();\n            Context.Response.ContentType = \"application\/json\";\n            \n            Context.Response.Write(sContent);\n        }\n    }\n}\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Remark : Soap xml \uc744 \uc870\ud68c\ud558\ub294 \uc6f9\uc11c\ube44\uc2a4\ub97c \ub9cc\ub4e4\uc5b4 \ubcf4\uc790 Json \ub9ac\ud134 Sample<\/p>\n<\/div>","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-6915","post","type-post","status-publish","format-standard","hentry","category-devc"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/6915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6915"}],"version-history":[{"count":0,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/6915\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}