{"id":2423,"date":"2022-11-09T05:32:41","date_gmt":"2022-11-09T05:32:41","guid":{"rendered":"https:\/\/serviceobjects.wpaladdin.com\/?post_type=serviceobjects&#038;p=2423"},"modified":"2024-03-29T09:08:27","modified_gmt":"2024-03-29T16:08:27","slug":"ad-soap","status":"publish","type":"page","link":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/","title":{"rendered":"AD &#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><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"ColdFusion\" tabindex=\"0\">ColdFusion<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"VB\" tabindex=\"0\">VB<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"Apex\" tabindex=\"0\">Apex<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"TSQL\" tabindex=\"0\">TSQL<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"NodeJS\" tabindex=\"0\">NodeJS<\/li><\/ul><div class=\"tab-content\">\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective 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=\"\">private FixedAddressResponse FindAddress(string Address1, string Address2, string City, string State, string PostalCode, string BusinessName, string PhoneNumber, string FullName, string FirstName, string LastName, string LicenseKey)\n       {\n           \/\/ addressValidation is a proxy used to simplify calls to the web-service\n           AddressDetectiveClient ADClient_Primary = null;\n           AddressDetectiveClient ADClient_Backup = null;\n           FixedAddressResponse response = null;\n           try\n           {\n               ADClient_Primary = new AddressDetectiveClient(\"DOTSAddressDetectivePrimary\");\n               ADClient_Primary.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 0, WEB_SERVICE_REQUEST_TIMEOUT);\n               response = ADClient_Primary.FindAddress(Address1, Address2, City, State, PostalCode, BusinessName, PhoneNumber, FullName, FirstName, LastName, LicenseKey);\n               \/\/NULL ERROR || FATAL ERROR RETURNED -- TRY BACKUP\n               if (response == null || (response.Error != null &amp;&amp; response.Error.TypeCode == \"3\"))\n               {\n                   throw new Exception();\n               }\n               return response;\n           }\n           catch (Exception)\n           {\n               try\n               {   \/\/Use swsbackup client on backup\n                   ADClient_Backup = new AddressDetectiveClient(\"DOTSAddressDetectiveBackup\");\n                   ADClient_Backup.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 0, WEB_SERVICE_REQUEST_TIMEOUT);\n                   return ADClient_Backup.FindAddress(Address1, Address2, City, State, PostalCode, BusinessName, PhoneNumber, FullName, FirstName, LastName, LicenseKey);\n               }\n               catch (Exception e)\n               {\n                   throw e;\n               }\n               finally\n               {\n                   if (ADClient_Backup != null) { ADClient_Backup.Close(); }\n               }\n           }\n           finally\n           {\n               if (ADClient_Primary != null) { ADClient_Primary.Close(); }\n           }\n       }\n       private void ProcessResponse(FixedAddressResponse response)\n       {\n           try\n           {\n               if (response.Error != null)\n               {\n                   ProcessErrorResult(response.Error);\n               }\n               else\n               {\n                   ProcessFindAddressResult(response);\n               }\n           }<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective Java Code Snippet<\/strong><\/p>\n\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=\"\">FixedAddress[] addresses = null;\nADError error= null;\n                                  \nString address1 = request.getParameter(\"iAddr1\");\nString address2 = request.getParameter(\"iAddr2\");\nString city = request.getParameter(\"iCity\");\nString state = request.getParameter(\"iState\");\nString postalCode = request.getParameter(\"iPostal\");\nString businessName = request.getParameter(\"iBusinessName\");\nString phoneNumber = request.getParameter(\"iPhoneNumber\");\nString fullName = request.getParameter(\"iFullName\");\nString firstName = request.getParameter(\"iFirstName\");\nString lastName = request.getParameter(\"iLastName\");\nString licenseKey = request.getParameter(\"iKey\");\n                                              \n                                  \nIAddressDetectiveProxy locator = new IAddressDetectiveProxy();\n\/\/use ssl\nlocator.setEndpoint(\"https:\/\/trial.serviceobjects.com\/ad\/api.svc\/soap\");\n                                  \nIAddressDetective ad = locator.getIAddressDetective();\nDOTSAddressDetectiveStub soap = (DOTSAddressDetectiveStub)ad;\nsoap.setTimeout(5000);\n                                  \ntry{\n     fixedAddressResponse = soap.findAddress(address1, address2, city, state, postalCode, businessName, phoneNumber, fullName, firstName, lastName, licenseKey);\n                                      \n      addresses = fixedAddressResponse.getAddresses();\n       error = fixedAddressResponse.getError();\n         if(error !=null &amp;&amp; error.getTypeCode() == \"3\")\n             {\n                 throw new Exception();\n             }\n  }\ncatch(Exception e)\n    {   \/\/FAILOVER- USE BACKUP NOW\n        try{\n            \/\/CALL SOAP USING BACKUP URL (Change the endpoint)\n            fixedAddressResponse = soap.findAddress(address1, address2, city, state, postalCode, businessName, phoneNumber, fullName, firstName, lastName, licenseKey);\n            addresses = fixedAddressResponse.getAddresses();\n            error = fixedAddressResponse.getError();\n            }\n      \n      \/\/DOTS Address Detective Results    \n    }\n    else\n    {\n        \/\/DOTS Address Detective Error \n    }<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective PHP Code Snippet<\/strong><\/p>\n\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      \n    $Address1 = trim($Address1);\n    $Address2 = trim($Address2);\n    $City = trim($City);\n    $State = trim($State);\n    $PostalCode = trim($PostalCode);\n    $BusinessName = trim($BusinessName);\n    $PhoneNumber = trim($PhoneNumber);\n    $FullName = trim($FullName);\n    $FirstName = trim($FirstName);\n    $LastName = trim($LastName);\n    $LicenseKey = trim($LicenseKey);\n   \n$wsdlUrl = \"https:\/\/trial.serviceobjects.com\/ad\/api.svc?wsdl\";\n      \ntry{\n    $soapClient = new SoapClient($wsdlUrl, array( \"trace\" => 1 ));\n    $result = $soapClient->FindAddress($params);\n    }\n    catch(Exception $e)\n        {\n            try\n            {\n            $soapClient = new SoapClient($backupWsdlUrl, array( \"trace\" => 1 ));\n            $result = $soapClient->FindAddress($params);\n            }\n            catch(Exception $ex)\n            {\/\/Both soap calls failed\n                echo \"&lt;b> Primary and backup wsdls failed &lt;\/b>\";\n                echo \"$ex\";\n            }\n          \n        }\n      \n    if (!isset($result->FindAddressResult->Error))\n     {\n        \/\/Process AD Result\n    }\n    else\n    {\n        \/\/Process AD Error\n    }\n}\n?><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective RoR Code Snippet<\/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=\"\">class RequestsController &lt; ApplicationController\n    def show\n        @request = Request.find(params[:id])\n        #Formats inputs into a hash to pass to Soap Client\n        #Hash Keys must be named as they are shown here.\n        message =   {\n                    \"Address1\" => @request.address1,\n                    \"Address2\" => @request.address2,\n                    \"City\" => @request.city,\n                    \"State\" => @request.state,\n                    \"PostalCode\" => @request.postalcode,\n                    \"BusinessName\" => @request.businessname,\n                    \"PhoneNumber\" => @request.phonenumber,\n                    \"FullName\" => @request.fullname,\n                    \"FirstName\" => @request.firstname,\n                    \"LastName\" => @request.lastname,\n                    \"LicenseKey\" => @request.licensekey,\n                    }\n          \n        #Implemented to make the code more readable when accessing the hash        \n        @adresponse = :find_address_response\n        @adresult = :find_address_result\n        @addresses = :addresses\n        @adfixed = :fixed_address\n        @aderror = :error\n        #Set Primary and Backup URLs here as needed\n        dotsADPrimary = \"https:\/\/trial.serviceobjects.com\/ad\/api.svc?singleWsdl\"\n        dotsADBackup = \"https:\/\/trial.serviceobjects.com\/ad\/api.svc?singleWsdl\"\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: dotsADPrimary,\n                                    element_form_default: :qualified,\n                                    convert_request_keys_to: :camelcase\n                                 )\n            #Calls the operation with given inptus and converts response to a hash.\n            response = client.call(:find_address, 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 the backupurl and attempt to retrieve data.\n        rescue Savon::Error => e\n            begin\n            backupclient = Savon.client(    wsdl: dotsADBackup,\n                                            element_form_default: :qualified,\n                                            convert_request_keys_to: :camelcase\n                                       )\n            #Sets the response to the backclient call to the operation and converts response to a hash.\n            response = backupclient.call(:find_address, message: message).to_hash\n            processresults(response)\n            #If backup url failed, this will display the error received from the server\n            rescue Savon::Error =>error\n                @status = error\n                @displaydata = {\"error\" => \"A Big Error Occured\"}\n            end\n        end\n    end\n    private\n    def processresults(response)           \n            #Processes Error Response from soap Client     \n              \n            #Processes Valid response from soap client \n              \n    end\n      \nend<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective Python Code Snippet<\/strong><\/p>\n\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=\"\">mAddress1 = Address1.get()\nif mAddress1 is None or mAddress1 == \"\":\n    mAddress1 = \" \"\nmAddress2 = Address2.get()\nif mAddress2 is None or mAddress2 == \"\":\n    mAddress2 = \" \"\nmCity = City.get()\nif mCity is None or mCity == \"\":\n    mCity = \" \"\nmState = State.get()\nif mState is None or mState == \"\":\n    mState = \" \"\nmPostalCode = PostalCode.get()\nif mPostalCode is None or mPostalCode == \"\":\n    mPostalCode = \" \"\nmBusinessName = BusinessName.get()\nif mBusinessName is None or mBusinessName == \"\":\n    mBusinessName = \" \"\nmPhoneNumber = PhoneNumber.get()\nif mPhoneNumber is None or mPhoneNumber == \"\":\n    mPhoneNumber = \" \"\nmFullName = FullName.get()\nif mFullName is None or mFullName == \"\":\n    mFullName = \" \"\nmFirstName = FirstName.get()\nif mFirstName is None or mFirstName == \"\":\n    mFirstName = \" \"\nmLastName = LastName.get()\nif mLastName is None or mLastName == \"\":\n    mLastName = \" \"\nmLicenseKey = LicenseKey.get()\nif mLicenseKey is None or mLicenseKey == \"\":\n    mLicenseKey = \" \"\n  \n#Set the primary and backup URLs as needed\nprimaryURL = 'https:\/\/trial.serviceobjects.com\/ad\/api.svc?wsdl'\nbackupURL = 'https:\/\/trial.serviceobjects.com\/ad\/api.svc?wsdl'\n  \n#This block of code calls the web service and prints the resulting values to the screen\ntry:\n    client = Client(primaryURL)\n    result = client.service.FindAddress(Address1=mAddress1, Address2=mAddress2, City=mCity, State=mState, PostalCode=mPostalCode, BusinessName=mBusinessName, PhoneNumber=mPhoneNumber, FullName=mFullName, FirstName=mFirstName, LastName=mLastName, LicenseKey=mLicenseKey)\n    #Handel response from the service\n          \n#Tries the backup URL if the primary URL failed\nexcept:\n    try:\n        client = Client(primaryURL)\n        result = client.service.FindAddress(Address1=mAddress1, Address2=mAddress2, City=mCity, State=mState, PostalCode=mPostalCode, BusinessName=mBusinessName, PhoneNumber=mPhoneNumber, FullName=mFullName, FirstName=mFirstName, LastName=mLastName, LicenseKey=mLicenseKey)\n      #Handel response from the service\n  \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<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!--Makes Request to web service --->\n&lt;cfscript>\n        try\n        {\n            if (isDefined(\"form.Action\") AND Action neq \"\")\n            {\n                wsresponse = CreateObject(\"webservice\", \"https:\/\/trial.serviceobjects.com\/ad\/api.svc?singleWsdl\");                           \n                outputs = wsresponse.findAddress(\"#Address1#\", \"#Address2#\", \"#City#\", \"#State#\", \"#PostalCode#\", \"#BusinessName#\", \"#PhoneNumber#\", \"#FullName#\", \"#FirstName#\", \"#LastName#\", \"#LicenseKey#\");\n                  \n            }\n        }\n    catch(any error){\n        try\n            {\n                if (isDefined(\"form.Action\") AND Action neq \"\")\n                {\n                    wsresponse = CreateObject(\"webservice\", \"https:\/\/trial.serviceobjects.com\/ad\/api.svc?singleWsdl\");                           \n                    outputs = wsresponse.findAddress(\"#Address1#\", \"#Address2#\", \"#City#\", \"#State#\", \"#PostalCode#\", \"#BusinessName#\", \"#PhoneNumber#\", \"#FullName#\", \"#FirstName#\", \"#LastName#\", \"#LicenseKey#\");\n                }\n            }\n            catch(any Exception)    {\n                 writeoutput(\"An Error Has Occured. Please Reload and try again\");              \n                }\n        }\n&lt;\/cfscript><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective Visual Basic Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"visualbasic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Try\n    Dim ws As New AD.AddressDetectiveClient\n    Dim response As AD.FixedAddressResponse\n    response = ws.FindAddress(Address1.Text, Address2.Text, City.Text, State.Text, PostalCode.Text, BusinessName.Text, PhoneNumber.Text, FullName.Text, FirstName.Text, LastName.Text, LicenseKey.Text)\n    If (response.Error Is Nothing) Then\n        ProcessValidResponse(response.Addresses(0))\n    Else\n        ProcessErrorResponse(response.Error)\n    End If\nCatch er As Exception\n    ''Set the Primary and Backup Service References as necessary\n    Try\n        Dim wsbackup As New AD.AddressDetectiveClient\n        Dim response As AD.FixedAddressResponse\n        response = wsbackup.FindAddress(Address1.Text, Address2.Text, City.Text, State.Text, PostalCode.Text, BusinessName.Text, PhoneNumber.Text, FullName.Text, FirstName.Text, LastName.Text, LicenseKey.Text)\n        If (response.Error Is Nothing) Then\n            ProcessValidResponse(response.Addresses(0))\n        Else\n            ProcessErrorResponse(response.Error)\n        End If\n    Catch ex As Exception\n        resultsLabel.Visible = True\n        resultsLabel.Text = ex.Message\n    End Try\nEnd Try<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective Apex Code Snippet<\/strong><\/p>\n\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=\"\">wwwServiceobjectsCom.FixedAddressResponse result;\ntry{\nwwwServiceobjectsCom.DOTSAddressDetective client = new wwwServiceobjectsCom.DOTSAddressDetective();\nresult = client.FindAddress([Address], [Address2], [City], [State], [PostalCode], [BusinessName], [PhoneNumber], [FullName], [FirstName], [LastName], [LicenseKey]);\n}\ncatch(Exception ex){\n \/\/If the first request failed try the failover endpoint\nwwwServiceobjectsCom.DOTSAddressDetective backupClient = new wwwServiceobjectsCom.DOTSAddressDetective();\n\/\/The backup environment will be provided to you upon purchasing a production license key\nbackupClient.endpoint_x = 'https:\/\/trial.serviceobjects.com\/AD\/api.svc\/soap';\nresult = backupClient.FindAddress([Address], [Address2], [City], [State], [PostalCode], [BusinessName], [PhoneNumber], [FullName], [FirstName], [LastName], [LicenseKey]);\n}<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective TSQL Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SET @requestBody ='&lt;s:Envelope xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\">'+\n                   '&lt;s:Body>'+\n                   '&lt;FindAddress xmlns=\"https:\/\/www.serviceobjects.com\">'+\n                   '&lt;Address1>' + @address1 + '&lt;\/Address1>'+\n                   '&lt;Address2>' + @address2 + '&lt;\/Address2>'+\n                   '&lt;City>' + @city + '&lt;\/City>&lt;State>' + @state + '&lt;\/State>'+\n                   '&lt;PostalCode>' + @postalcode + '&lt;\/PostalCode>'+\n                   '&lt;PhoneNumber>'+ @phonenumber + '&lt;\/PhoneNumber>'+\n                   '&lt;FullName>'+ @fullname + '&lt;\/FullName>'+\n                   '&lt;FirstName>'+ @firstname + '&lt;\/FirstName>'+\n                   '&lt;LastName>'+ @lastname + '&lt;\/LastName>'+\n                   '&lt;LicenseKey>' + @key + '&lt;\/LicenseKey>'+\n                   '&lt;\/FindAddress>'+\n                   '&lt;\/s:Body>'+\n                   '&lt;\/s:Envelope>'\nSET @requestLength = LEN(@requestBody)\n    --If a production key is purchased, this will execute the failover\nIF @isLiveKey = 1\nBEGIN\n    EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT\n    EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https:\/\/trial.serviceobjects.com\/AD\/api.svc\/soap', false\n    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'sws.serviceobjects.com'\n    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text\/xml; charset=UTF-8'\n    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '\"https:\/\/www.serviceobjects.com\/IAddressDetective\/FindAddress\"'\n    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength\n    EXEC sp_OAMethod @obj, 'send', NULL, @requestBody\n    EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT\n    EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT\n    EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT\n              \n    --Checks the Response for a fatal error or if null.\n    IF @response IS NULL\n    BEGIN\n        EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT\n        EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https:\/\/trial.serviceobjects.com\/AD\/api.svc\/soap', false\n        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'swsbackup.serviceobjects.com'\n        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text\/xml; charset=UTF-8'\n        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '\"https:\/\/www.serviceobjects.com\/IAddressDetective\/FindAddress\"'\n        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength\n        EXEC sp_OAMethod @obj, 'send', NULL, @requestBody\n        EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT\n        EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT\n        EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT\n    END\nEND<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Detective NodeJS Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var args = {Address1: 'Address1',\n            Address2: 'Address2',\n            City: 'City',\n            State: 'State',\n            PostalCode: 'PostalCode',\n            BusinessName: 'BusinessName',\n            PhoneNumber: 'PhoneNumber',\n            FullName: 'FullName',\n            FirstName: 'FirstName',\n            LastName: 'LastName',\n            LicenseKey: 'Your-License-Key'};\n            soap.createClient(primaryUrl, function(err, client) {\n                  \n                client.FindAddress(args, function(err, result) {\n                    \/\/This is where you will handle the service results. Your business logic will determine\n                    \/\/how the validated information is used.\n                    \/\/The exact output can be found in our documentation:\n                    \/\/https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/\n                    if(err != null || result == null)\n                    {\n                        \/\/There was an error that occurred that wasn't part of the normal service response\n                        return;\n                    }\n                    else{\n                        \/\/Check for an error object\n                        if(result.FindAddressResult.Error != null)\n                        {\n                            \/\/An error object was returned by the service and you will want to use\n                            \/\/the following failover logic.\n                            \/\/If it was a Service Objects Fatal exception we recommend trying\n                            \/\/a backup server.\n                            if(result.FindAddressResult.Error.TypeCode == \"3\")\n                            {\n                                \/\/The actual backup url will be provided when you purchase a license key\n                                var backupUrl = 'https:\/\/trial.serviceobjects.com\/ad\/api.svc?singleWsdl';\n                                soap.createClient(backupUrl, function(failoverErr, backupClient) {\n                  \n                                    backupClient.FindAddress(args, function(failoverErr, failoverResult) {\n                                        \/\/Handle the failoverErr or failoverResult objects.\n                                        return;\n                                    });\n                                });\n                            }\n                        }\n                    }\n                }<\/pre>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":1622,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2423","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>AD - SOAP<\/title>\n<meta name=\"description\" content=\"C#JavaPHPRoRPythonColdFusionVBApexTSQLNodeJS Address Detective C# Code Snippet private FixedAddressResponse FindAddress(string Address1, string Address2,\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AD - SOAP\" \/>\n<meta property=\"og:description\" content=\"C#JavaPHPRoRPythonColdFusionVBApexTSQLNodeJS Address Detective C# Code Snippet private FixedAddressResponse FindAddress(string Address1, string Address2,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-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-29T16:08:27+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:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/\",\"name\":\"AD - SOAP\",\"isPartOf\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#website\"},\"datePublished\":\"2022-11-09T05:32:41+00:00\",\"dateModified\":\"2024-03-29T16:08:27+00:00\",\"description\":\"C#JavaPHPRoRPythonColdFusionVBApexTSQLNodeJS Address Detective C# Code Snippet private FixedAddressResponse FindAddress(string Address1, string Address2,\",\"breadcrumb\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/test.serviceobjects.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DOTS Address Detective\",\"item\":\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"AD &#8211; Code Snippets and Sample Code\",\"item\":\"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"AD &#8211; SOAP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#website\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/test.serviceobjects.com\/docs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#organization\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"contentUrl\":\"https:\/\/test.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:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AD - SOAP","description":"C#JavaPHPRoRPythonColdFusionVBApexTSQLNodeJS Address Detective C# Code Snippet private FixedAddressResponse FindAddress(string Address1, string Address2,","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"AD - SOAP","og_description":"C#JavaPHPRoRPythonColdFusionVBApexTSQLNodeJS Address Detective C# Code Snippet private FixedAddressResponse FindAddress(string Address1, string Address2,","og_url":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/","og_site_name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","article_modified_time":"2024-03-29T16:08:27+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/","url":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/","name":"AD - SOAP","isPartOf":{"@id":"https:\/\/test.serviceobjects.com\/docs\/#website"},"datePublished":"2022-11-09T05:32:41+00:00","dateModified":"2024-03-29T16:08:27+00:00","description":"C#JavaPHPRoRPythonColdFusionVBApexTSQLNodeJS Address Detective C# Code Snippet private FixedAddressResponse FindAddress(string Address1, string Address2,","breadcrumb":{"@id":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/ad-soap\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/test.serviceobjects.com\/docs\/"},{"@type":"ListItem","position":2,"name":"DOTS Address Detective","item":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/"},{"@type":"ListItem","position":3,"name":"AD &#8211; Code Snippets and Sample Code","item":"https:\/\/test.serviceobjects.com\/docs\/dots-address-detective\/ad-code-snippets-and-sample-code\/"},{"@type":"ListItem","position":4,"name":"AD &#8211; SOAP"}]},{"@type":"WebSite","@id":"https:\/\/test.serviceobjects.com\/docs\/#website","url":"https:\/\/test.serviceobjects.com\/docs\/","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","description":"","publisher":{"@id":"https:\/\/test.serviceobjects.com\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/test.serviceobjects.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/test.serviceobjects.com\/docs\/#organization","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","url":"https:\/\/test.serviceobjects.com\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/test.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","contentUrl":"https:\/\/test.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:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/2423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/comments?post=2423"}],"version-history":[{"count":23,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/2423\/revisions"}],"predecessor-version":[{"id":10036,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/2423\/revisions\/10036"}],"up":[{"embeddable":true,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/1622"}],"wp:attachment":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/media?parent=2423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}