BIN Validation C# Rest Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
//encodes the URLs for the get Call. Set the primary and back urls as necessary
string primaryurl = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + bin + "&LicenseKey=" + licensekey;
string backupurl = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + bin + "&LicenseKey=" + licensekey;
BVResponse_Rest.BinValidationResult wsresponse = httpGet(primaryurl);
//checks if a response was returned from the service, uses the backup url if response is null or a fatal error occured.
if (wsresponse == null || (wsresponse.Error != null && wsresponse.Error.TypeCode == "3"));
{
wsresponse = httpGet(backupurl);
}
if (wsresponse.Error != null)
{
ProcessErrorResponse(wsresponse.Error);
}
else
{
ProcessSuccessfulResponse(wsresponse.BinValidationInfo);
}
//encodes the URLs for the get Call. Set the primary and back urls as necessary string primaryurl = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + bin + "&LicenseKey=" + licensekey; string backupurl = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + bin + "&LicenseKey=" + licensekey; BVResponse_Rest.BinValidationResult wsresponse = httpGet(primaryurl); //checks if a response was returned from the service, uses the backup url if response is null or a fatal error occured. if (wsresponse == null || (wsresponse.Error != null && wsresponse.Error.TypeCode == "3")); { wsresponse = httpGet(backupurl); } if (wsresponse.Error != null) { ProcessErrorResponse(wsresponse.Error); } else { ProcessSuccessfulResponse(wsresponse.BinValidationInfo); }
//encodes the URLs for the get Call. Set the primary and back urls as necessary
string primaryurl = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + bin + "&LicenseKey=" + licensekey;
string backupurl = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + bin + "&LicenseKey=" + licensekey;
BVResponse_Rest.BinValidationResult wsresponse = httpGet(primaryurl);
 
//checks if a response was returned from the service, uses the backup url if response is null or a fatal error occured.
if (wsresponse == null || (wsresponse.Error != null && wsresponse.Error.TypeCode == "3"));
{
    wsresponse = httpGet(backupurl);
}
if (wsresponse.Error != null)
{
    ProcessErrorResponse(wsresponse.Error);
}
else
{
    ProcessSuccessfulResponse(wsresponse.BinValidationInfo);
}

BIN Validation Java Rest Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
JSONObject results = RestClient(mainURL);
try {
if (ErrorMessages != null || (results.getJSONObject("BinValidationResult").has("Error") && results.getJSONObject("BinValidationResult").getJSONObject("Error").get("DescCode") == "3")) {
// BACKUP
results = RestClient(backupURL);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return results;
JSONObject results = RestClient(mainURL); try { if (ErrorMessages != null || (results.getJSONObject("BinValidationResult").has("Error") && results.getJSONObject("BinValidationResult").getJSONObject("Error").get("DescCode") == "3")) { // BACKUP results = RestClient(backupURL); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return results;
JSONObject results = RestClient(mainURL);  
try {
    if (ErrorMessages != null || (results.getJSONObject("BinValidationResult").has("Error") && results.getJSONObject("BinValidationResult").getJSONObject("Error").get("DescCode") == "3")) {
        // BACKUP
        results = RestClient(backupURL);
    }
} catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
 
return results;

BIN Validation PHP Rest Code Snippets

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$URL = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=".urlencode($BIN)."&LicenseKey=".urlencode($LicenseKey);
//use backup url once given purchased license key
$backupURL = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=".urlencode($BIN)."&LicenseKey=".urlencode($LicenseKey);
try{
// Get cURL resource
$curl = curl_init();
curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $URL, CURLOPT_USERAGENT => 'Service Objects BIN Validation'));
curl_setopt($curl, CURLOPT_TIMEOUT, 50); //timeout in seconds
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
if($resp == false)
{
echo "IN back up block";
curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $backupURL, CURLOPT_USERAGENT => 'Service Objects BIN Validation'));
curl_setopt($curl, CURLOPT_TIMEOUT, 50); //timeout in seconds
// Send the request & save response to $resp
$resp = curl_exec($curl);
if($resp == false)
{
echo "<b> Both rest calls failed </b>";
curl_close($curl);
return;
}
}
$URL = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=".urlencode($BIN)."&LicenseKey=".urlencode($LicenseKey); //use backup url once given purchased license key $backupURL = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=".urlencode($BIN)."&LicenseKey=".urlencode($LicenseKey); try{ // Get cURL resource $curl = curl_init(); curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $URL, CURLOPT_USERAGENT => 'Service Objects BIN Validation')); curl_setopt($curl, CURLOPT_TIMEOUT, 50); //timeout in seconds // Send the request & save response to $resp $resp = curl_exec($curl); // Close request to clear up some resources if($resp == false) { echo "IN back up block"; curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $backupURL, CURLOPT_USERAGENT => 'Service Objects BIN Validation')); curl_setopt($curl, CURLOPT_TIMEOUT, 50); //timeout in seconds // Send the request & save response to $resp $resp = curl_exec($curl); if($resp == false) { echo "<b> Both rest calls failed </b>"; curl_close($curl); return; } }
$URL = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=".urlencode($BIN)."&LicenseKey=".urlencode($LicenseKey);
//use backup url once given purchased license key
$backupURL = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=".urlencode($BIN)."&LicenseKey=".urlencode($LicenseKey);
try{
    // Get cURL resource
    $curl = curl_init();
    curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $URL, CURLOPT_USERAGENT => 'Service Objects BIN Validation'));
    curl_setopt($curl, CURLOPT_TIMEOUT, 50); //timeout in seconds
    // Send the request & save response to $resp
    $resp = curl_exec($curl);
     
    // Close request to clear up some resources
    if($resp == false)
    {
        echo "IN back up block";
        curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $backupURL, CURLOPT_USERAGENT => 'Service Objects BIN Validation'));
        curl_setopt($curl, CURLOPT_TIMEOUT, 50); //timeout in seconds
        // Send the request & save response to $resp
        $resp = curl_exec($curl);
        if($resp == false)
        {
            echo "<b> Both rest calls failed </b>";
            curl_close($curl);
            return;
        }
    }

BIN Validation RoR Code Snippets

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@request = Request.find(params[:id])
#This sets the default timeout for HTTParty get operation. This must be set in order to use the gem
default_timeout = 10
binnumber = @request.binnumber
licensekey = @request.licensekey
#Set Primary and Backup URLs as needed. This method encodes and standardizes the URI to pass to the REST service.
primaryURL = URI.encode("https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + binnumber + "&LicenseKey=" + licensekey)
backupURL = URI.encode("https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + binnumber + "&LicenseKey=" + licensekey)
#These are set to access the hash that is returned
@bvresult ="BinValidationResult"
@bvinfo = "BinValidationInfo"
@bverror = "Error"
#Begins the call the RESTful web service
begin
response = HTTParty.get(primaryURL, timeout: default_timeout)
#processes the response to display to the screen
#Passes the response returned from HTTParty and processes them depending on the results
processresults(response)
rescue StandardError => e
begin
#uses the backupURl in the event that the service encountered an error
response = HTTParty.get(backupURL, timeout: default_timeout)
#processes the response returned from using the backupURL
processresults(response)
#If the backup url railed this will raise an error and display the
#error message returned from the HTTParty gem.
rescue StandardError => error
@status = error.message
@displaydata = {"Error" => "A Big Error Occured"}
end
end
@request = Request.find(params[:id]) #This sets the default timeout for HTTParty get operation. This must be set in order to use the gem default_timeout = 10 binnumber = @request.binnumber licensekey = @request.licensekey #Set Primary and Backup URLs as needed. This method encodes and standardizes the URI to pass to the REST service. primaryURL = URI.encode("https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + binnumber + "&LicenseKey=" + licensekey) backupURL = URI.encode("https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + binnumber + "&LicenseKey=" + licensekey) #These are set to access the hash that is returned @bvresult ="BinValidationResult" @bvinfo = "BinValidationInfo" @bverror = "Error" #Begins the call the RESTful web service begin response = HTTParty.get(primaryURL, timeout: default_timeout) #processes the response to display to the screen #Passes the response returned from HTTParty and processes them depending on the results processresults(response) rescue StandardError => e begin #uses the backupURl in the event that the service encountered an error response = HTTParty.get(backupURL, timeout: default_timeout) #processes the response returned from using the backupURL processresults(response) #If the backup url railed this will raise an error and display the #error message returned from the HTTParty gem. rescue StandardError => error @status = error.message @displaydata = {"Error" => "A Big Error Occured"} end end
@request = Request.find(params[:id])
#This sets the default timeout for HTTParty get operation. This must be set in order to use the gem
default_timeout = 10
binnumber = @request.binnumber
licensekey = @request.licensekey
#Set Primary and Backup URLs as needed. This method encodes and standardizes the URI to pass to the REST service.
primaryURL = URI.encode("https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + binnumber + "&LicenseKey=" + licensekey)
backupURL = URI.encode("https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" + binnumber + "&LicenseKey=" + licensekey)
 
#These are set to access the hash that is returned
@bvresult ="BinValidationResult"
@bvinfo = "BinValidationInfo"
@bverror = "Error"
  #Begins the call the RESTful web service
begin
  response = HTTParty.get(primaryURL, timeout: default_timeout)
  #processes the response to display to the screen
   
  #Passes the response returned from HTTParty and processes them depending on the results
  processresults(response)
 rescue StandardError => e
      begin
      #uses the backupURl in the event that the service encountered an error
      response = HTTParty.get(backupURL, timeout: default_timeout)
     
    #processes the response returned from using the backupURL
      processresults(response)
    #If the backup url railed this will raise an error and display the
    #error message returned from the HTTParty gem.
      rescue StandardError => error
          @status = error.message
          @displaydata = {"Error" => "A Big Error Occured"}
      end
end

BIN Validation Python Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#Set the primary and backup URLs as necessary
#The Requests package allows the user to format the path parameters like so instead of having to manually insert them into the URL
inputs = {'BinNumber': mBinNumber, 'LicenseKey': mLicenseKey}
try:
result = requests.get(primaryURL, params=inputs)
#Parses the XML response from the service into a python dictionary type
outputs = xmltodict.parse(result.content)
#checks the output for Errors and displays the info accordingly
if 'Error' in outputs['BinValidationResult']:
#loops through the response from the service and prints the values to the screen.
for key, value in outputs['BinValidationResult']['Error'].iteritems():
Label(swin.window, text=str(key) + " : " + str(value)).pack()
#Prints a valid response if one was received from the service
else:
for key, value in outputs['BinValidationResult']['BinValidationInfo'].iteritems():
Label(swin.window, text=str(key) + " : " + str(value)).pack()
#Attempts to use the backupURL if the call to the primary URL failed
except:
try:
result = requests.get(backupURL, params=inputs)
#Parses the XML response from the service into a python dictionary type
outputs = xmltodict.parse(result.content)
#checks the output for Errors and displays the info accordingly
if 'Error' in outputs['BinValidationResult']:
#loops through the response from the service and prints the values to the screen.
for key, value in outputs['BinValidationResult']['Error'].iteritems():
Label(swin.window, text=str(key) + " : " + str(value)).pack()
#Prints a valid response if one was received from the service
else:
for key, value in outputs['BinValidationResult']['BinValidationInfo'].iteritems():
Label(swin.window, text=str(key) + " : " + str(value)).pack()
#Set the primary and backup URLs as necessary primaryURL = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?' backupURL = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?' #The Requests package allows the user to format the path parameters like so instead of having to manually insert them into the URL inputs = {'BinNumber': mBinNumber, 'LicenseKey': mLicenseKey} try: result = requests.get(primaryURL, params=inputs) #Parses the XML response from the service into a python dictionary type outputs = xmltodict.parse(result.content) #checks the output for Errors and displays the info accordingly if 'Error' in outputs['BinValidationResult']: #loops through the response from the service and prints the values to the screen. for key, value in outputs['BinValidationResult']['Error'].iteritems(): Label(swin.window, text=str(key) + " : " + str(value)).pack() #Prints a valid response if one was received from the service else: for key, value in outputs['BinValidationResult']['BinValidationInfo'].iteritems(): Label(swin.window, text=str(key) + " : " + str(value)).pack() #Attempts to use the backupURL if the call to the primary URL failed except: try: result = requests.get(backupURL, params=inputs) #Parses the XML response from the service into a python dictionary type outputs = xmltodict.parse(result.content) #checks the output for Errors and displays the info accordingly if 'Error' in outputs['BinValidationResult']: #loops through the response from the service and prints the values to the screen. for key, value in outputs['BinValidationResult']['Error'].iteritems(): Label(swin.window, text=str(key) + " : " + str(value)).pack() #Prints a valid response if one was received from the service else: for key, value in outputs['BinValidationResult']['BinValidationInfo'].iteritems(): Label(swin.window, text=str(key) + " : " + str(value)).pack()
#Set the primary and backup URLs as necessary
primaryURL = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?'
backupURL = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?'
#The Requests package allows the user to format the path parameters like so instead of having to manually insert them into the URL
inputs = {'BinNumber': mBinNumber, 'LicenseKey': mLicenseKey}
try:
    result = requests.get(primaryURL, params=inputs)
    #Parses the XML response from the service into a python dictionary type
    outputs = xmltodict.parse(result.content)
    #checks the output for Errors and displays the info accordingly
    if 'Error' in outputs['BinValidationResult']:
        #loops through the response from the service and prints the values to the screen.
        for key, value in outputs['BinValidationResult']['Error'].iteritems():
            Label(swin.window, text=str(key) + " : " + str(value)).pack()
    #Prints a valid response if one was received from the service
    else:
        for key, value in outputs['BinValidationResult']['BinValidationInfo'].iteritems():
            Label(swin.window, text=str(key) + " : " + str(value)).pack()
#Attempts to use the backupURL if the call to the primary URL failed
except:
    try:
        result = requests.get(backupURL, params=inputs)
        #Parses the XML response from the service into a python dictionary type
        outputs = xmltodict.parse(result.content)
        #checks the output for Errors and displays the info accordingly
        if 'Error' in outputs['BinValidationResult']:
            #loops through the response from the service and prints the values to the screen.
            for key, value in outputs['BinValidationResult']['Error'].iteritems():
                Label(swin.window, text=str(key) + " : " + str(value)).pack()
        #Prints a valid response if one was received from the service
        else:
            for key, value in outputs['BinValidationResult']['BinValidationInfo'].iteritems():
                Label(swin.window, text=str(key) + " : " + str(value)).pack()

BIN Validation ColdFusion Rest Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!--Makes Request to web service --->
<cfIf isDefined("form.Action") AND Action neq "" >
<cftry>
<cfhttp url="#primaryURL#" method="get" result="response">
<cfset outputs = XmlParse(response.FileContent)>
<cfcatch>
<cftry>
<cfhttp url="#backupURL#" method="get" result="response">
<cfset outputs = XmlParse(response.FileContent)>
<cfcatch >
<cfoutput >
The Following Error Occured: #response.StatusCode#
</cfoutput>
</cfcatch>
</cftry>
</cfcatch>
</cftry>
</cfif>
<!--Makes Request to web service ---> <cfIf isDefined("form.Action") AND Action neq "" > <cftry> <cfset primaryURL = "https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=#BinNumber#&LicenseKey=#LicenseKey#"> <cfhttp url="#primaryURL#" method="get" result="response"> <cfset outputs = XmlParse(response.FileContent)> <cfcatch> <cftry> <cfset backupURL = "https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=#BinNumber#&LicenseKey=#LicenseKey#"> <cfhttp url="#backupURL#" method="get" result="response"> <cfset outputs = XmlParse(response.FileContent)> <cfcatch > <cfoutput > The Following Error Occured: #response.StatusCode# </cfoutput> </cfcatch> </cftry> </cfcatch> </cftry> </cfif>
<!--Makes Request to web service --->
<cfIf isDefined("form.Action") AND Action neq "" >
    <cftry>
        <cfset primaryURL = "https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=#BinNumber#&LicenseKey=#LicenseKey#">
        <cfhttp url="#primaryURL#" method="get" result="response">
        <cfset outputs = XmlParse(response.FileContent)>
        <cfcatch>
            <cftry>
                <cfset backupURL = "https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=#BinNumber#&LicenseKey=#LicenseKey#">
                <cfhttp url="#backupURL#" method="get" result="response">
                <cfset outputs = XmlParse(response.FileContent)>             
                <cfcatch >
                    <cfoutput >
                        The Following Error Occured: #response.StatusCode#
                    </cfoutput>
                </cfcatch>
            </cftry>
        </cfcatch>
    </cftry>
</cfif>

BIN Validation VB Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Try
'encodes the URLs for the get Call. Set the primary and back urls as necessary
Dim primaryurl As String = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" & bin + "&LicenseKey=" & licensekey
Dim backupurl As String = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" & bin + "&LicenseKey=" & licensekey
Dim wsresponse As BVResponse.BinValidationResult = httpGet(primaryurl)
'checks if a response was returned from the service, uses the backup url if response is null or a fatal error occured.
If wsresponse Is Nothing OrElse (wsresponse.[Error] IsNot Nothing AndAlso wsresponse.[Error].TypeCode = "3") Then
wsresponse = httpGet(backupurl)
End If
If wsresponse.[Error] IsNot Nothing Then
ProcessErrorResponse(wsresponse.[Error])
Else
ProcessSuccessfulResponse(wsresponse.BinValidationInfo)
End If
Catch ex As Exception
'Displays the relevant error mesasge if both backup and primary urls failed.
StatusLabel.Text = ex.Message
StatusLabel.Visible = True
End Try
Try 'encodes the URLs for the get Call. Set the primary and back urls as necessary Dim primaryurl As String = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" & bin + "&LicenseKey=" & licensekey Dim backupurl As String = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" & bin + "&LicenseKey=" & licensekey Dim wsresponse As BVResponse.BinValidationResult = httpGet(primaryurl) 'checks if a response was returned from the service, uses the backup url if response is null or a fatal error occured. If wsresponse Is Nothing OrElse (wsresponse.[Error] IsNot Nothing AndAlso wsresponse.[Error].TypeCode = "3") Then wsresponse = httpGet(backupurl) End If If wsresponse.[Error] IsNot Nothing Then ProcessErrorResponse(wsresponse.[Error]) Else ProcessSuccessfulResponse(wsresponse.BinValidationInfo) End If Catch ex As Exception 'Displays the relevant error mesasge if both backup and primary urls failed. StatusLabel.Text = ex.Message StatusLabel.Visible = True End Try
Try
    'encodes the URLs for the get Call. Set the primary and back urls as necessary
    Dim primaryurl As String = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" & bin + "&LicenseKey=" & licensekey
    Dim backupurl As String = "https://trial.serviceobjects.com/BV/web.svc/json/ValidateBIN_V2?BinNumber=" & bin + "&LicenseKey=" & licensekey
    Dim wsresponse As BVResponse.BinValidationResult = httpGet(primaryurl)
 
    'checks if a response was returned from the service, uses the backup url if response is null or a fatal error occured.
    If wsresponse Is Nothing OrElse (wsresponse.[Error] IsNot Nothing AndAlso wsresponse.[Error].TypeCode = "3") Then
        wsresponse = httpGet(backupurl)
    End If
    If wsresponse.[Error] IsNot Nothing Then
        ProcessErrorResponse(wsresponse.[Error])
    Else
        ProcessSuccessfulResponse(wsresponse.BinValidationInfo)
 
    End If
Catch ex As Exception
    'Displays the relevant error mesasge if both backup and primary urls failed.
    StatusLabel.Text = ex.Message
    StatusLabel.Visible = True
End Try

BIN Validation TSQL Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
IF @isLiveKey = 1
BEGIN
EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
EXEC sp_OAMethod @obj, 'Open', NULL, 'Get', @sUrl, false
EXEC sp_OAMethod @obj, 'send'
EXEC sp_OAGetProperty @obj, 'responseText', @response OUT
--Checks the Response for a fatal error or if null.
IF @response IS NULL
BEGIN
SET @sBackupUrl = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=' + @bin + '&LicenseKey=' + @key
EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
EXEC sp_OAMethod @obj, 'Open', NULL, 'Get', @sBackupUrl, false
EXEC sp_OAMethod @obj, 'send'
EXEC sp_OAGetProperty @obj, 'responseText', @response OUT
END
END
IF @isLiveKey = 1 BEGIN SET @sUrl = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=' + @bin + '&LicenseKey=' + @key EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT EXEC sp_OAMethod @obj, 'Open', NULL, 'Get', @sUrl, false EXEC sp_OAMethod @obj, 'send' EXEC sp_OAGetProperty @obj, 'responseText', @response OUT --Checks the Response for a fatal error or if null. IF @response IS NULL BEGIN SET @sBackupUrl = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=' + @bin + '&LicenseKey=' + @key EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT EXEC sp_OAMethod @obj, 'Open', NULL, 'Get', @sBackupUrl, false EXEC sp_OAMethod @obj, 'send' EXEC sp_OAGetProperty @obj, 'responseText', @response OUT END END
IF @isLiveKey = 1
BEGIN
    SET @sUrl = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=' + @bin + '&LicenseKey=' + @key
    EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
    EXEC sp_OAMethod @obj, 'Open', NULL, 'Get', @sUrl, false
    EXEC sp_OAMethod @obj, 'send'
    EXEC sp_OAGetProperty @obj, 'responseText', @response OUT
             
    --Checks the Response for a fatal error or if null.
    IF @response IS NULL
    BEGIN
        SET @sBackupUrl = 'https://trial.serviceobjects.com/BV/web.svc/xml/ValidateBIN_V2?BinNumber=' + @bin + '&LicenseKey=' + @key
        EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
        EXEC sp_OAMethod @obj, 'Open', NULL, 'Get', @sBackupUrl, false
        EXEC sp_OAMethod @obj, 'send'
        EXEC sp_OAGetProperty @obj, 'responseText', @response OUT
    END
END