{"id":5422,"date":"2022-11-14T18:00:31","date_gmt":"2022-11-14T18:00:31","guid":{"rendered":"https:\/\/serviceobjects.wpaladdin.com\/?page_id=5422"},"modified":"2024-03-26T16:15:22","modified_gmt":"2024-03-26T23:15:22","slug":"ur-soap","status":"publish","type":"page","link":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/","title":{"rendered":"UR &#8211; SOAP"},"content":{"rendered":"\n<div class=\"wp-block-create-block-tabs\"><ul class=\"tab-labels\" role=\"tablist\" aria-label=\"tabbed content\"><li class=\"tab-label active\" role=\"tab\" aria-selected=\"true\" aria-controls=\"C#\" tabindex=\"0\">C#<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"Java\" tabindex=\"0\">Java<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"PHP\" tabindex=\"0\">PHP<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"RoR\" tabindex=\"0\">RoR<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"Python\" tabindex=\"0\">Python<\/li><\/ul><div class=\"tab-content\">\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Usage Reports C# Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/Add a service to your application https:\/\/trial.serviceobjects.com\/ur\/usagereports.asmx?op=GetDOTSTransactionDetailsByDateRange\nDOTSUsageReportsSoapClient Client = new DOTSUsageReportsSoapClient()\nResponse = Client.GetDOTSTransactionDetailsByDateRange(inputLicenseKey.Text, inputEmailAddress.Text, inputBeginDate.Text, inputEndDate.Text);\n         \nif (response.Error != null)\n{\n    \/\/Process Error\n}\nelse\n{\n    \/\/Process Response     \n}<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\">\n\n<p><strong>Usage Reports Java Code Snippet<\/strong><\/p>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Declare Result Object\nReportTransactionDetailUsage Response = null;\nReportDailyUsage usage[] = null;\n     \n\/\/ Create client through proxy class\nDOTSUsageReportsLocator locator = new DOTSUsageReportsLocator();\n   \n\/\/ Handle request to client\nDOTSUsageReportsSoap ur = locator.getDOTSUsageReportsSoap();\n  \n\/\/ Handle any errors in response\nError error;\n  \nResponse = soap.getDOTSTransactionDetailsByDateRange(LicenseKey, Email, BeginDate, EndDate);\nusage = Response.getDailyUsage();\nerror = Response.getError();\nif(error !=null &amp;&amp; error.getNumber() == \"3\")\n{\nthrow new Exception(); \n}\n  \n\/\/Process Results\nif(error == null){\n    \/\/DOTS Usage Reports Results   \n}\n\/\/Process Errors\nelse{\n    \/\/DOTS Usage Reprots Error Results \n}<\/pre>\n\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\">\n\n<p><strong>Usage Reports PHP Code Snippets<\/strong><\/p>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ Set these values per web service &lt;as needed&gt;\n$wsdlUrl = \"https:\/\/trial.serviceobjects.com\/ur\/usagereports.asmx?WSDL\";\n \n$params['LicenseKey']   = $LicenseKey;\n$params['Email']        = $Email;\n$params['BeginDate']    = $BeginDate;\n$params['EndDate']      = $EndDate;\n \n$soapClient = new SoapClient($wsdlUrl, array( \"trace\" =&gt; 1 ));\n$result = $soapClient-&gt;GetDOTSTransactionDetailsByDateRange ($params);\n$result= $response-&gt;GetDOTSTransactionDetailsByDateRangeResult\n$result= $response-&gt;GetDOTSTransGetDOTSTransactionDetailsByDateRangeResult;\n \nif (!isset($result-&gt;Error)) {\n    foreach($result as $k=&gt;$v) {\n        echo $k . \", \" . $v;\n    }\n} else {\n    foreach($result-&gt;Error as $k=&gt;$v) {\n        echo $k . \", \" . $v;\n    }\n}\n?&gt;<\/pre>\n\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Usage Reports RoR SOAP Code Snippets<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"ruby\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#Formats inputs into a hash to pass to Soap Client\n    #Hash Keys must be named as they are shown here.\n    message =   {\n                \"LicenseKey\" => @request.licensekey,\n                \"Email\" => @request.email,\n                \"BeginDate\" => @request.begindate,\n                \"EndDate\" => @request.enddate\n                }\n    #Implemented to make the code more readable when accessing the hash        \n    @urresponse = :get_dots_transaction_details_by_date_range_response\n    @urresult = :get_dots_transaction_details_by_date_range_result\n    @urdailyusage = :daily_usage\n    @urerror = :error\n \n    #Set Primary and Backup URLs here as needed\n    dotsURPrimary = \"https:\/\/trial.serviceobjects.com\/ur\/usagereports.asmx?WSDL\"\n    dotsURBackup = \"https:\/\/trial.serviceobjects.com\/ur\/usagereports.asmx?WSDL\"\n \n    begin\n        #initializes the soap client. The convert request keys global is necessary to receive a response from the service.\n        client = Savon.client(  wsdl: dotsURPrimary)\n        #Calls the operation with given inptus and converts response to a hash.\n        response = client.call(:get_dots_transaction_details_by_date_range, message: message).to_hash\n        #Checks to see what results came back from the service\n        processresults(response)           \n         \n    #If an error occurs during the call, this will use backup url and attempt to retrieve data.\n    rescue Savon::Error => e\n        begin\n        backupclient = Savon.client(wsdl: dotsURBackup)\n        #Sets the response to the backclient call to the operation and converts response to a hash.\n        response = backupclient.call(:get_dots_transaction_details_by_date_range, message: message).to_hash\n        processresults(response)\n \n        #If backup url failed, this will display the error received from the server\n        rescue Savon::Error =>error\n        end\n    end\nend\nprivate\ndef processresults(response)   \n        #Processes Error Response from soap Client     \n        #Processes Valid response from soap client \nend<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\">\n\n<p><strong>Usage Reports Python Code Snippet<\/strong><\/p>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mEmail = Email.get()\nif mEmail is None or mEmail == \"\":\n    mEmail = \" \"\nmBeginDate = BeginDate.get()\nif mBeginDate is None or mBeginDate == \"\":\n    mBeginDate = \" \"\nmEndDate = EndDate.get()\nif mEndDate is None or mEndDate == \"\":\n    mEndDate = \" \"\nmLicenseKey = LicenseKey.get()\nif mLicenseKey is None or mLicenseKey == \"\":\n    mLicenseKey = \" \"\n \n#Set Primary and Backup URLs here as needed\nprimaryURL = 'https:\/\/trial.serviceobjects.com\/ur\/usagereports.asmx?WSDL'\nbackupURL ='https:\/\/trial.serviceobjects.com\/ur\/usagereports.asmx?WSDL'\n \n#calling web service and print results\ntry:\n    client = Client(primaryURL)\n    result = client.service.GetDOTSTransactionDetailsByDateRange(Email=mEmail, BeginDate=mBeginDate, EndDate=mEndDate, LicenseKey=mLicenseKey)\n    #Handel response and check for errors\n \n#failover to backupURL\nexcept:\n    try:\n        client = Client(backupURL)\n        result = client.service.GetDOTSTransactionDetailsByDateRange(Email=mEmail, BeginDate=mBeginDate,EndDate=mEndDate, LicenseKey=mLicenseKey)\n        #Handel response and check for errors\n \n    #If the backup call failed then this will display an error to the screen\n    except:\n        Label(swin.window, text='Error').pack()\n        print (result)<\/pre>\n\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":5420,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5422","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>UR - SOAP<\/title>\n<meta name=\"description\" content=\"C#JavaPHPRoRPython Usage Reports C# Code Snippet \/\/Add a service to your application\" \/>\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.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UR - SOAP\" \/>\n<meta property=\"og:description\" content=\"C#JavaPHPRoRPython Usage Reports C# Code Snippet \/\/Add a service to your application\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-26T23:15:22+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/\",\"name\":\"UR - SOAP\",\"isPartOf\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#website\"},\"datePublished\":\"2022-11-14T18:00:31+00:00\",\"dateModified\":\"2024-03-26T23:15:22+00:00\",\"description\":\"C#JavaPHPRoRPython Usage Reports C# Code Snippet \/\/Add a service to your application\",\"breadcrumb\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DOTS Usage Report\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"UR &#8211; Code Snippets and Sample Code\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"UR &#8211; SOAP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#website\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.serviceobjects.com\/docs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#organization\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"contentUrl\":\"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"width\":2560,\"height\":1440,\"caption\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\"},\"image\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"UR - SOAP","description":"C#JavaPHPRoRPython Usage Reports C# Code Snippet \/\/Add a service to your application","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.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/","og_locale":"en_US","og_type":"article","og_title":"UR - SOAP","og_description":"C#JavaPHPRoRPython Usage Reports C# Code Snippet \/\/Add a service to your application","og_url":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/","og_site_name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","article_modified_time":"2024-03-26T23:15:22+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/","url":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/","name":"UR - SOAP","isPartOf":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#website"},"datePublished":"2022-11-14T18:00:31+00:00","dateModified":"2024-03-26T23:15:22+00:00","description":"C#JavaPHPRoRPython Usage Reports C# Code Snippet \/\/Add a service to your application","breadcrumb":{"@id":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/ur-soap\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.serviceobjects.com\/docs\/"},{"@type":"ListItem","position":2,"name":"DOTS Usage Report","item":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/"},{"@type":"ListItem","position":3,"name":"UR &#8211; Code Snippets and Sample Code","item":"https:\/\/www.serviceobjects.com\/docs\/dots-usage-report\/ur-code-snippets-and-sample-code\/"},{"@type":"ListItem","position":4,"name":"UR &#8211; SOAP"}]},{"@type":"WebSite","@id":"https:\/\/www.serviceobjects.com\/docs\/#website","url":"https:\/\/www.serviceobjects.com\/docs\/","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","description":"","publisher":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.serviceobjects.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.serviceobjects.com\/docs\/#organization","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","url":"https:\/\/www.serviceobjects.com\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","contentUrl":"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","width":2560,"height":1440,"caption":"Service Objects | Contact, Phone, Email Verification | Data Quality Services"},"image":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/comments?post=5422"}],"version-history":[{"count":7,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5422\/revisions"}],"predecessor-version":[{"id":10008,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5422\/revisions\/10008"}],"up":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5420"}],"wp:attachment":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/media?parent=5422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}