{"id":2268,"date":"2013-04-24T16:06:21","date_gmt":"2013-04-24T07:06:21","guid":{"rendered":"http:\/\/auctionpro.co.kr\/?p=2268"},"modified":"2023-02-22T11:28:19","modified_gmt":"2023-02-22T02:28:19","slug":"c-soapsample","status":"publish","type":"post","link":"https:\/\/www.auctionpro.co.kr\/?p=2268","title":{"rendered":"C# SoapSample credentials (ID Password)"},"content":{"rendered":"\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \" title=\"SoapClass\" >using System.Xml;\nusing System.Net;\nusing System.IO;\nusing System.Text;\n\nnamespace UniRecord\n{\n    public class SoapClass\n    {\n        public static string CallWebService()\n        {\n            var _url = \"https:\/\/test.com\/B2BGateway\/connect\/uAPI\";\n            var _action = \"https:\/\/test.com\/uAPI\/UniversalRecordService\"; \/\/EndPoint\n\n            XmlDocument soapEnvelopeXml = CreateSoapEnvelope();\n            HttpWebRequest webRequest = CreateWebRequest(_url, _action);\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();\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 static HttpWebRequest CreateWebRequest(string url, string action)\n        {\n            string credentials = \"ID:Password\";\n            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(action); \/\/action \uc0ac\uc6a9\n            webRequest.Headers.Add(\"Authorization\", \"Basic \" + Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials)));\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 static XmlDocument CreateSoapEnvelope()\n        {\n            XmlDocument soapEnvelop = new XmlDocument();\n            soapEnvelop.LoadXml(@\"&lt;soapenv:Envelope xmlns:soapenv='http:\/\/schemas.xmlsoap.org\/soap\/envelope\/' xmlns:univ='http:\/\/www.travelport.com\/schema\/universal_v31_0' xmlns:com='http:\/\/www.travelport.com\/schema\/common_v31_0'&gt;\" +\n                                               \"&lt;soapenv:Header&gt;\" +\n                                                  \"&lt;univ:SupportedVersions\/&gt;\" +\n                                               \"&lt;\/soapenv:Header&gt;\" +\n                                               \"&lt;soapenv:Body&gt;\" +\n                                                  \"&lt;univ:UniversalRecordRetrieveReq TraceId='trace' AuthorizedBy='user' TargetBranch='ID'  RetrieveProviderReservationDetails='false' ViewOnlyInd='false'&gt;\" +\n                                                     \"&lt;com:BillingPointOfSaleInfo OriginApplication='UAPI'\/&gt;\" +\n                                                     \"&lt;univ:UniversalRecordLocatorCode&gt;PNR001&lt;\/univ:UniversalRecordLocatorCode&gt;\" +\n                                                  \"&lt;\/univ:UniversalRecordRetrieveReq&gt;\" +\n                                               \"&lt;\/soapenv:Body&gt;\" +\n                                            \"&lt;\/soapenv:Envelope&gt;\");\n            return soapEnvelop;\n        }\n\n        private static void InsertSoapEnvelopeIntoWebRequest(XmlDocument soapEnvelopeXml, HttpWebRequest webRequest)\n        {\n            using (Stream stream = webRequest.GetRequestStream())\n            {\n                soapEnvelopeXml.Save(stream);\n            }\n        }\n\n\n    }\n}\n \uc0ad\uc81c<\/pre><\/div>\n\n\n\n<p><br>\ucc38\uc870 :\u00a0http:\/\/stackoverflow.com\/questions\/4791794\/client-to-send-soap-request-and-received-respons<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>\ucc38\uc870 :\u00a0http:\/\/stackoverflow.com\/questions\/4791794\/client-to-send-soap-request-and-received-respons<\/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,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-2268","post","type-post","status-publish","format-standard","hentry","category-devc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C# SoapSample credentials (ID Password) - AuctionPro<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.auctionpro.co.kr\/?p=2268\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C# SoapSample credentials (ID Password) - AuctionPro\" \/>\n<meta property=\"og:description\" content=\"\ucc38\uc870 :\u00a0http:\/\/stackoverflow.com\/questions\/4791794\/client-to-send-soap-request-and-received-respons\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.auctionpro.co.kr\/?p=2268\" \/>\n<meta property=\"og:site_name\" content=\"AuctionPro\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-24T07:06:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-22T02:28:19+00:00\" \/>\n<meta name=\"author\" content=\"golgol\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"golgol\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268\"},\"author\":{\"name\":\"golgol\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#\\\/schema\\\/person\\\/d3dbae599b06cd55f5b14a3e2116f7a2\"},\"headline\":\"C# SoapSample credentials (ID Password)\",\"datePublished\":\"2013-04-24T07:06:21+00:00\",\"dateModified\":\"2023-02-22T02:28:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268\"},\"wordCount\":10,\"commentCount\":0,\"articleSection\":[\"[Dev]C#\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268\",\"url\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268\",\"name\":\"C# SoapSample credentials (ID Password) - AuctionPro\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#website\"},\"datePublished\":\"2013-04-24T07:06:21+00:00\",\"dateModified\":\"2023-02-22T02:28:19+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#\\\/schema\\\/person\\\/d3dbae599b06cd55f5b14a3e2116f7a2\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=2268#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C# SoapSample credentials (ID Password)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#website\",\"url\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/\",\"name\":\"AuctionPro\",\"description\":\"\uc625\uc158\ud504\ub85c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#\\\/schema\\\/person\\\/d3dbae599b06cd55f5b14a3e2116f7a2\",\"name\":\"golgol\",\"url\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?author=6\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C# SoapSample credentials (ID Password) - AuctionPro","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.auctionpro.co.kr\/?p=2268","og_locale":"ko_KR","og_type":"article","og_title":"C# SoapSample credentials (ID Password) - AuctionPro","og_description":"\ucc38\uc870 :\u00a0http:\/\/stackoverflow.com\/questions\/4791794\/client-to-send-soap-request-and-received-respons","og_url":"https:\/\/www.auctionpro.co.kr\/?p=2268","og_site_name":"AuctionPro","article_published_time":"2013-04-24T07:06:21+00:00","article_modified_time":"2023-02-22T02:28:19+00:00","author":"golgol","twitter_card":"summary_large_image","twitter_misc":{"\uae00\uc4f4\uc774":"golgol","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"1\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.auctionpro.co.kr\/?p=2268#article","isPartOf":{"@id":"https:\/\/www.auctionpro.co.kr\/?p=2268"},"author":{"name":"golgol","@id":"https:\/\/www.auctionpro.co.kr\/#\/schema\/person\/d3dbae599b06cd55f5b14a3e2116f7a2"},"headline":"C# SoapSample credentials (ID Password)","datePublished":"2013-04-24T07:06:21+00:00","dateModified":"2023-02-22T02:28:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.auctionpro.co.kr\/?p=2268"},"wordCount":10,"commentCount":0,"articleSection":["[Dev]C#"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.auctionpro.co.kr\/?p=2268#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.auctionpro.co.kr\/?p=2268","url":"https:\/\/www.auctionpro.co.kr\/?p=2268","name":"C# SoapSample credentials (ID Password) - AuctionPro","isPartOf":{"@id":"https:\/\/www.auctionpro.co.kr\/#website"},"datePublished":"2013-04-24T07:06:21+00:00","dateModified":"2023-02-22T02:28:19+00:00","author":{"@id":"https:\/\/www.auctionpro.co.kr\/#\/schema\/person\/d3dbae599b06cd55f5b14a3e2116f7a2"},"breadcrumb":{"@id":"https:\/\/www.auctionpro.co.kr\/?p=2268#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.auctionpro.co.kr\/?p=2268"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.auctionpro.co.kr\/?p=2268#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/www.auctionpro.co.kr\/"},{"@type":"ListItem","position":2,"name":"C# SoapSample credentials (ID Password)"}]},{"@type":"WebSite","@id":"https:\/\/www.auctionpro.co.kr\/#website","url":"https:\/\/www.auctionpro.co.kr\/","name":"AuctionPro","description":"\uc625\uc158\ud504\ub85c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.auctionpro.co.kr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Person","@id":"https:\/\/www.auctionpro.co.kr\/#\/schema\/person\/d3dbae599b06cd55f5b14a3e2116f7a2","name":"golgol","url":"https:\/\/www.auctionpro.co.kr\/?author=6"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2268","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=2268"}],"version-history":[{"count":0,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2268\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}