Phone Exchange C# Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
//Add a service to your application https://trial.serviceobjects.com/GGPL2/api.svc?wsdl
GeoPhonePlusClient GPPL2Client_Primary = new GeoPhonePlusClient("DOTSGPPL2");
PhoneInfoResponse response = GPPL2Client_Primary.GetPhoneInfo(inputPhoneNumber, inputTestType, inputLicenseKey);
if (response.Error != null)
{
//Process Error
}
else
{
//Process Response
}
//Add a service to your application https://trial.serviceobjects.com/GGPL2/api.svc?wsdl GeoPhonePlusClient GPPL2Client_Primary = new GeoPhonePlusClient("DOTSGPPL2"); PhoneInfoResponse response = GPPL2Client_Primary.GetPhoneInfo(inputPhoneNumber, inputTestType, inputLicenseKey); if (response.Error != null) { //Process Error } else { //Process Response }
//Add a service to your application https://trial.serviceobjects.com/GGPL2/api.svc?wsdl
GeoPhonePlusClient GPPL2Client_Primary = new GeoPhonePlusClient("DOTSGPPL2");
PhoneInfoResponse response = GPPL2Client_Primary.GetPhoneInfo(inputPhoneNumber, inputTestType, inputLicenseKey);
          
if (response.Error != null)
{
    //Process Error
}
else
{
    //Process Response     
}

Phone Exchange Java Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
PhoneInfoResponse GPPL2Response = null;
PhoneInfoResult info = null;
GPPL2Error error = null;
// Create soap request
GeoPhonePlusLocator locator = new GeoPhonePlusLocator();
// use ssl
locator.setGeoPhonePlusSoapEndpointAddress("https://trial.serviceobjects.com/GPPL2/api.svc/GeoPhonePlusSoap");
IGeoPhonePlus av = locator.getGeoPhonePlusSoap();
GeoPhonePlusSoapStub soap = (GeoPhonePlusSoapStub)av;
soap.setTimeout(5000);
GPPL2Response = soap.getPhoneInfo(phoneNumber, testType, licensekey);
info = GPPL2Response.getPhoneInfo();
error = GPPL2Response.getError();
if(resp == null || (error != null && error.getTypeCode() == "3"))
{
throw new Exception();
}
//Process Results
if(error == null){
//DOTS GeoPhone Plus 2 Results
}
//Process Errors
else{
//DOTS GeoPhone Plus 2 Error Results
}
PhoneInfoResponse GPPL2Response = null; PhoneInfoResult info = null; GPPL2Error error = null; // Create soap request GeoPhonePlusLocator locator = new GeoPhonePlusLocator(); // use ssl locator.setGeoPhonePlusSoapEndpointAddress("https://trial.serviceobjects.com/GPPL2/api.svc/GeoPhonePlusSoap"); IGeoPhonePlus av = locator.getGeoPhonePlusSoap(); GeoPhonePlusSoapStub soap = (GeoPhonePlusSoapStub)av; soap.setTimeout(5000); GPPL2Response = soap.getPhoneInfo(phoneNumber, testType, licensekey); info = GPPL2Response.getPhoneInfo(); error = GPPL2Response.getError(); if(resp == null || (error != null && error.getTypeCode() == "3")) { throw new Exception(); } //Process Results if(error == null){ //DOTS GeoPhone Plus 2 Results } //Process Errors else{ //DOTS GeoPhone Plus 2 Error Results }
PhoneInfoResponse GPPL2Response = null;
PhoneInfoResult info = null;
GPPL2Error error = null;
// Create soap request
GeoPhonePlusLocator locator = new GeoPhonePlusLocator();
// use ssl
locator.setGeoPhonePlusSoapEndpointAddress("https://trial.serviceobjects.com/GPPL2/api.svc/GeoPhonePlusSoap");
IGeoPhonePlus av = locator.getGeoPhonePlusSoap();                          
GeoPhonePlusSoapStub soap = (GeoPhonePlusSoapStub)av;
soap.setTimeout(5000);
GPPL2Response = soap.getPhoneInfo(phoneNumber, testType, licensekey);
info = GPPL2Response.getPhoneInfo();
error = GPPL2Response.getError();
if(resp == null || (error != null && error.getTypeCode() == "3"))
{
    throw new Exception();
}
   
//Process Results
if(error == null){
    //DOTS GeoPhone Plus 2 Results 
}
//Process Errors
else{
    //DOTS GeoPhone Plus 2 Error Results   
}

Phone Exchange PHP Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<?php
// Set these values per web service <as needed>
$params['PhoneNumber'] = $PhoneNumber;
$params['TestType'] = $TestType;
$params['LicenseKey'] = $LicenseKey;
$soapClient = new SoapClient($wsdlUrl, array( "trace" => 1 ));
$result = $soapClient->GetPhoneInfo($params);
if (!isset($result->GetPhoneInfoResult->Error)) {
foreach($result->GetPhoneInfoResult->PhoneInfo as $k=>$v) {
echo $k . ", " . $v;
}
} else {
foreach($result->GetPhoneInfoResult->Error as $k=>$v) {
echo $k . ", " . $v;
}
}
?>
<?php // Set these values per web service <as needed> $wsdlUrl = "https://trial.serviceobjects.com/gppl2/api.svc?wsdl"; $params['PhoneNumber'] = $PhoneNumber; $params['TestType'] = $TestType; $params['LicenseKey'] = $LicenseKey; $soapClient = new SoapClient($wsdlUrl, array( "trace" => 1 )); $result = $soapClient->GetPhoneInfo($params); if (!isset($result->GetPhoneInfoResult->Error)) { foreach($result->GetPhoneInfoResult->PhoneInfo as $k=>$v) { echo $k . ", " . $v; } } else { foreach($result->GetPhoneInfoResult->Error as $k=>$v) { echo $k . ", " . $v; } } ?>
<?php
// Set these values per web service <as needed>
$wsdlUrl = "https://trial.serviceobjects.com/gppl2/api.svc?wsdl";
  
$params['PhoneNumber']  = $PhoneNumber;
$params['TestType']     = $TestType;
$params['LicenseKey']   = $LicenseKey;
  
$soapClient = new SoapClient($wsdlUrl, array( "trace" => 1 ));
$result = $soapClient->GetPhoneInfo($params);
if (!isset($result->GetPhoneInfoResult->Error)) {
    foreach($result->GetPhoneInfoResult->PhoneInfo as $k=>$v) {
        echo $k . ", " . $v;
    }
} else {
    foreach($result->GetPhoneInfoResult->Error as $k=>$v) {
        echo $k . ", " . $v;
    }
}
?>

Phone Exchange RoR Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#Formats inputs into a hash to pass to Soap Client
#Hash Keys must be named as they are shown here.
message = {
"PhoneNumber" => @request.phonenumber,
"LicenseKey" => @request.licensekey
}
#Implemented to make the code more readable when accessing the hash
@gppl2response = :get_phone_info_response
@gppl2result = :get_phone_info_result
@gppl2info = :phone_info
@gppl2provider = :provider
@gppl2contacts = :contacts
@gppl2contact = :contact
@gppl2error = :error
#Set Primary and Backup URLs here as needed
begin
#initializes the soap client. The convert request keys global is necessary to receive a response from the service.
client = Savon.client(wsdl: dotsGPPL2Primary)
#Calls the given operation with given inptus and converts response to a hash.
response = client.call(:get_phone_info, message: message).to_hash
#Checks to see what results came back from the service
processresults(response)
#If an error occurs during the call, this will use the backup url and attempt to retrieve data.
rescue Savon::Error =>e
begin
backupclient = Savon.client(wsdl: dotsGPPL2Backup)
#Sets the response to the backclient call to the operation and converts response to a hash.
response = backupclient.call(:get_phone_info, message: message).to_hash
processresults(response)
#If dotsEV3Backup failed, this will display the error received from the server
rescue Savon::Error =>error
end
end
end
private
def processresults(response)
#Processes Error Response from soap Client
#Processes Valid response from soap Client
end
#Formats inputs into a hash to pass to Soap Client #Hash Keys must be named as they are shown here. message = { "PhoneNumber" => @request.phonenumber, "LicenseKey" => @request.licensekey } #Implemented to make the code more readable when accessing the hash @gppl2response = :get_phone_info_response @gppl2result = :get_phone_info_result @gppl2info = :phone_info @gppl2provider = :provider @gppl2contacts = :contacts @gppl2contact = :contact @gppl2error = :error #Set Primary and Backup URLs here as needed dotsGPPL2Primary = "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL" dotsGPPL2Backup = "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL" begin #initializes the soap client. The convert request keys global is necessary to receive a response from the service. client = Savon.client(wsdl: dotsGPPL2Primary) #Calls the given operation with given inptus and converts response to a hash. response = client.call(:get_phone_info, message: message).to_hash #Checks to see what results came back from the service processresults(response) #If an error occurs during the call, this will use the backup url and attempt to retrieve data. rescue Savon::Error =>e begin backupclient = Savon.client(wsdl: dotsGPPL2Backup) #Sets the response to the backclient call to the operation and converts response to a hash. response = backupclient.call(:get_phone_info, message: message).to_hash processresults(response) #If dotsEV3Backup failed, this will display the error received from the server rescue Savon::Error =>error end end end private def processresults(response) #Processes Error Response from soap Client #Processes Valid response from soap Client end
#Formats inputs into a hash to pass to Soap Client
    #Hash Keys must be named as they are shown here.
    message =   {
                "PhoneNumber" => @request.phonenumber,
                "LicenseKey" => @request.licensekey
                }
      
    #Implemented to make the code more readable when accessing the hash        
    @gppl2response = :get_phone_info_response
    @gppl2result = :get_phone_info_result
    @gppl2info = :phone_info
    @gppl2provider = :provider
    @gppl2contacts = :contacts
    @gppl2contact = :contact
    @gppl2error = :error
  
    #Set Primary and Backup URLs here as needed
    dotsGPPL2Primary = "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL"
    dotsGPPL2Backup = "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL"
  
    begin
        #initializes the soap client. The convert request keys global is necessary to receive a response from the service.
        client = Savon.client(wsdl: dotsGPPL2Primary)
        #Calls the given operation with given inptus and converts response to a hash.
        response = client.call(:get_phone_info, message: message).to_hash
  
        #Checks to see what results came back from the service
        processresults(response)           
          
    #If an error occurs during the call, this will use the backup url and attempt to retrieve data.
    rescue Savon::Error =>e
        begin
        backupclient = Savon.client(wsdl: dotsGPPL2Backup)
        #Sets the response to the backclient call to the operation and converts response to a hash.
        response = backupclient.call(:get_phone_info, message: message).to_hash
  
        processresults(response)
        #If dotsEV3Backup failed, this will display the error received from the server
        rescue Savon::Error =>error
        end
    end
end
private
def processresults(response)   
        #Processes Error Response from soap Client     
        #Processes Valid response from soap Client
end

Phone Exchange Python Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mPhoneNumber = PhoneNumber.get()
if mPhoneNumber is None or mPhoneNumber == "":
mPhoneNumber = " "
mTestType = TestType.get()
if mTestType is None or mTestType == "":
mTestType = " "
mLicenseKey = LicenseKey.get()
if mLicenseKey is None or mLicenseKey == "":
mLicenseKey = " "
#Set the primary and backup URLs as needed
#This block of code calls the web service and prints the resulting values to the screen
try:
client = Client(primaryURL)
result = client.service.GetPhoneInfo(PhoneNumber=mPhoneNumber, TestType=mTestType, LicenseKey=mLicenseKey)
#Handel response and check for errors
#Tries the backup URL if the primary URL failed
except:
try:
client = Client(backupURL)
result = client.service.GetPhoneInfo(PhoneNumber=mPhoneNumber, TestType=mTestType, LicenseKey=mLicenseKey)
#Handel response and check for errors
#If the backup call failed then this will display an error to the screen
except:
Label(swin.window, text='Error').pack()
print (result)
mPhoneNumber = PhoneNumber.get() if mPhoneNumber is None or mPhoneNumber == "": mPhoneNumber = " " mTestType = TestType.get() if mTestType is None or mTestType == "": mTestType = " " mLicenseKey = LicenseKey.get() if mLicenseKey is None or mLicenseKey == "": mLicenseKey = " " #Set the primary and backup URLs as needed primaryURL = 'https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL' backupURL = 'https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL' #This block of code calls the web service and prints the resulting values to the screen try: client = Client(primaryURL) result = client.service.GetPhoneInfo(PhoneNumber=mPhoneNumber, TestType=mTestType, LicenseKey=mLicenseKey) #Handel response and check for errors #Tries the backup URL if the primary URL failed except: try: client = Client(backupURL) result = client.service.GetPhoneInfo(PhoneNumber=mPhoneNumber, TestType=mTestType, LicenseKey=mLicenseKey) #Handel response and check for errors #If the backup call failed then this will display an error to the screen except: Label(swin.window, text='Error').pack() print (result)
mPhoneNumber = PhoneNumber.get()
if mPhoneNumber is None or mPhoneNumber == "":
    mPhoneNumber = " "
mTestType = TestType.get()
if mTestType is None or mTestType == "":
    mTestType = " "
mLicenseKey = LicenseKey.get()
if mLicenseKey is None or mLicenseKey == "":
    mLicenseKey = " "
  
#Set the primary and backup URLs as needed
primaryURL = 'https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL'
backupURL = 'https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL'
  
 #This block of code calls the web service and prints the resulting values to the screen
try:
    client = Client(primaryURL)
    result = client.service.GetPhoneInfo(PhoneNumber=mPhoneNumber, TestType=mTestType, LicenseKey=mLicenseKey)
    #Handel response and check for errors
  
#Tries the backup URL if the primary URL failed
except:
    try:
        client = Client(backupURL)
        result = client.service.GetPhoneInfo(PhoneNumber=mPhoneNumber, TestType=mTestType, LicenseKey=mLicenseKey)
       #Handel response and check for errors
  
    #If the backup call failed then this will display an error to the screen
    except:
        Label(swin.window, text='Error').pack()
        print (result)

Phone Exchange 2 ColdFusion Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!--Makes Request to web service --->
<cfscript>
try
{
if (isDefined("form.Action") AND Action neq "")
{
wsresponse = CreateObject("webservice", "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL");
outputs = wsresponse.getPhoneInfo("#PhoneNumber#", "#TestType#", "#LicenseKey#");
}
}
catch(any Exception){
try
{
if (isDefined("form.Action") AND Action neq "")
{
wsresponse = CreateObject("webservice", "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL");
outputs = wsresponse.getPhoneInfo("#PhoneNumber#", "#LicenseKey#");
}
}
catch(any Exception)
{
writeoutput("An Error Has Occured. Please Reload and try again");
}
}
</cfscript>
<!--Makes Request to web service ---> <cfscript> try { if (isDefined("form.Action") AND Action neq "") { wsresponse = CreateObject("webservice", "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL"); outputs = wsresponse.getPhoneInfo("#PhoneNumber#", "#TestType#", "#LicenseKey#"); } } catch(any Exception){ try { if (isDefined("form.Action") AND Action neq "") { wsresponse = CreateObject("webservice", "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL"); outputs = wsresponse.getPhoneInfo("#PhoneNumber#", "#LicenseKey#"); } } catch(any Exception) { writeoutput("An Error Has Occured. Please Reload and try again"); } } </cfscript>
<!--Makes Request to web service --->
<cfscript>
        try
        {
            if (isDefined("form.Action") AND Action neq "")
            {
                wsresponse = CreateObject("webservice", "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL");                            
                outputs = wsresponse.getPhoneInfo("#PhoneNumber#", "#TestType#", "#LicenseKey#");          
            }
        }
    catch(any Exception){
        try
            {
                if (isDefined("form.Action") AND Action neq "")
                {
                    wsresponse = CreateObject("webservice", "https://trial.serviceobjects.com/gppl2/api.svc?singleWSDL");                            
                    outputs = wsresponse.getPhoneInfo("#PhoneNumber#", "#LicenseKey#");
                }
            }
            catch(any Exception)   
                {
                 writeoutput("An Error Has Occured. Please Reload and try again");              
                }
        }
          
 </cfscript>

Phone Exchange 2 VB Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Try
Dim ws As New GPPL2.GeoPhonePlusClient
Dim response As GPPL2.PhoneInfoResponse
response = ws.GetPhoneInfo(PhoneNumber.Text, TestType.Text, LicenseKey.Text)
If (response.Error Is Nothing) Then
ProcessValidResponse(response)
Else
ProcessErrorResponse(response.Error)
End If
Catch er As Exception
Try
''Set the primary and backup service references as necessary
Dim wsbackup As New GPPL2.GeoPhonePlusClient
Dim response As GPPL2.PhoneInfoResponse
response = wsbackup.GetPhoneInfo(PhoneNumber.Text, TestType.Text, LicenseKey.Text)
If (response.Error Is Nothing) Then
ProcessValidResponse(response)
Else
ProcessErrorResponse(response.Error)
End If
Catch ex As Exception
resultsLabel.Visible = True
resultsLabel.Text = ex.Message
End Try
End Try
Try Dim ws As New GPPL2.GeoPhonePlusClient Dim response As GPPL2.PhoneInfoResponse response = ws.GetPhoneInfo(PhoneNumber.Text, TestType.Text, LicenseKey.Text) If (response.Error Is Nothing) Then ProcessValidResponse(response) Else ProcessErrorResponse(response.Error) End If Catch er As Exception Try ''Set the primary and backup service references as necessary Dim wsbackup As New GPPL2.GeoPhonePlusClient Dim response As GPPL2.PhoneInfoResponse response = wsbackup.GetPhoneInfo(PhoneNumber.Text, TestType.Text, LicenseKey.Text) If (response.Error Is Nothing) Then ProcessValidResponse(response) Else ProcessErrorResponse(response.Error) End If Catch ex As Exception resultsLabel.Visible = True resultsLabel.Text = ex.Message End Try End Try
Try
    Dim ws As New GPPL2.GeoPhonePlusClient
    Dim response As GPPL2.PhoneInfoResponse
    response = ws.GetPhoneInfo(PhoneNumber.Text, TestType.Text, LicenseKey.Text)
    If (response.Error Is Nothing) Then
        ProcessValidResponse(response)
    Else
        ProcessErrorResponse(response.Error)
    End If
  
Catch er As Exception
    Try
        ''Set the primary and backup service references as necessary
        Dim wsbackup As New GPPL2.GeoPhonePlusClient
        Dim response As GPPL2.PhoneInfoResponse
        response = wsbackup.GetPhoneInfo(PhoneNumber.Text, TestType.Text, LicenseKey.Text)
        If (response.Error Is Nothing) Then
            ProcessValidResponse(response)
        Else
            ProcessErrorResponse(response.Error)
        End If
    Catch ex As Exception
        resultsLabel.Visible = True
        resultsLabel.Text = ex.Message
    End Try
End Try

Phone Exchange 2 Apex Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
wwwServiceobjectsCom.PhoneInfoResponse result;
try{
wwwServiceobjectsCom.GeoPhonePlusSoap client = new wwwServiceobjectsCom.GeoPhonePlusSoap();
result = client.GetPhoneInfo([PhoneNumber], [TestType], [LicenseKey]);
}
catch(Exception ex){
//If the first request failed try the failover endpoint
wwwServiceobjectsCom.GeoPhonePlusSoap backupClient = new wwwServiceobjectsCom.GeoPhonePlusSoap();
//The backup environment will be provided to you upon purchasing a production license key
backupClient.endpoint_x = 'https://trial.serviceobjects.com/GPPL2/api.svc/soap';
result = backupClient.GetPhoneInfo([PhoneNumber], [TestType], [LicenseKey]);
}
wwwServiceobjectsCom.PhoneInfoResponse result; try{ wwwServiceobjectsCom.GeoPhonePlusSoap client = new wwwServiceobjectsCom.GeoPhonePlusSoap(); result = client.GetPhoneInfo([PhoneNumber], [TestType], [LicenseKey]); } catch(Exception ex){ //If the first request failed try the failover endpoint wwwServiceobjectsCom.GeoPhonePlusSoap backupClient = new wwwServiceobjectsCom.GeoPhonePlusSoap(); //The backup environment will be provided to you upon purchasing a production license key backupClient.endpoint_x = 'https://trial.serviceobjects.com/GPPL2/api.svc/soap'; result = backupClient.GetPhoneInfo([PhoneNumber], [TestType], [LicenseKey]); }
wwwServiceobjectsCom.PhoneInfoResponse result;
try{
wwwServiceobjectsCom.GeoPhonePlusSoap client = new wwwServiceobjectsCom.GeoPhonePlusSoap();
result = client.GetPhoneInfo([PhoneNumber], [TestType], [LicenseKey]);
}
catch(Exception ex){
 //If the first request failed try the failover endpoint
wwwServiceobjectsCom.GeoPhonePlusSoap backupClient = new wwwServiceobjectsCom.GeoPhonePlusSoap();
//The backup environment will be provided to you upon purchasing a production license key
backupClient.endpoint_x = 'https://trial.serviceobjects.com/GPPL2/api.svc/soap';
result = backupClient.GetPhoneInfo([PhoneNumber], [TestType], [LicenseKey]);
}

Phone Exchange 2 TSQL Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SET @requestBody ='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'+
'<s:Body>'+
'<ValidateEmailAddress xmlns="https://www.serviceobjects.com">'+
'<EmailAddress>' + @email + '</EmailAddress>'+
'<AllowCorrections>' + @allowcorrections + '</AllowCorrections>'+
'<Timeout>' + @timeout + '</Timeout>'+
'<LicenseKey>' + @key + '</LicenseKey>'+
'</ValidateEmailAddress>'+
'</s:Body>'+
'</s:Envelope>'
SET @requestLength = LEN(@requestBody)
--If a production key is purchased, this will execute the failover
IF @isLiveKey = 1
BEGIN
EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https://sws.serviceobjects.com/ev3/soap.svc/soap', false
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'sws.serviceobjects.com'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=UTF-8'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '"https://www.serviceobjects.com/IEV3Library/ValidateEmailAddress"'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength
EXEC sp_OAMethod @obj, 'send', NULL, @requestBody
EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT
EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT
EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT
--Checks the Response for a fatal error or if null.
IF @response IS NULL
BEGIN
EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https://swsbackup.serviceobjects.com/ev3/soap.svc/soap', false
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'swsbackup.serviceobjects.com'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=UTF-8'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '"https://www.serviceobjects.com/IEV3Library/ValidateEmailAddress"'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength
EXEC sp_OAMethod @obj, 'send', NULL, @requestBody
EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT
EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT
EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT
END
END
SET @requestBody ='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'+ '<s:Body>'+ '<ValidateEmailAddress xmlns="https://www.serviceobjects.com">'+ '<EmailAddress>' + @email + '</EmailAddress>'+ '<AllowCorrections>' + @allowcorrections + '</AllowCorrections>'+ '<Timeout>' + @timeout + '</Timeout>'+ '<LicenseKey>' + @key + '</LicenseKey>'+ '</ValidateEmailAddress>'+ '</s:Body>'+ '</s:Envelope>' SET @requestLength = LEN(@requestBody) --If a production key is purchased, this will execute the failover IF @isLiveKey = 1 BEGIN EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https://sws.serviceobjects.com/ev3/soap.svc/soap', false EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'sws.serviceobjects.com' EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=UTF-8' EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '"https://www.serviceobjects.com/IEV3Library/ValidateEmailAddress"' EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength EXEC sp_OAMethod @obj, 'send', NULL, @requestBody EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT --Checks the Response for a fatal error or if null. IF @response IS NULL BEGIN EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https://swsbackup.serviceobjects.com/ev3/soap.svc/soap', false EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'swsbackup.serviceobjects.com' EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=UTF-8' EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '"https://www.serviceobjects.com/IEV3Library/ValidateEmailAddress"' EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength EXEC sp_OAMethod @obj, 'send', NULL, @requestBody EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT END END
SET @requestBody ='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'+
                   '<s:Body>'+
                   '<ValidateEmailAddress xmlns="https://www.serviceobjects.com">'+
                   '<EmailAddress>' + @email + '</EmailAddress>'+
                   '<AllowCorrections>' + @allowcorrections + '</AllowCorrections>'+
                   '<Timeout>' + @timeout + '</Timeout>'+
                   '<LicenseKey>' + @key + '</LicenseKey>'+
                   '</ValidateEmailAddress>'+
                   '</s:Body>'+
                   '</s:Envelope>'
SET @requestLength = LEN(@requestBody)
    --If a production key is purchased, this will execute the failover
IF @isLiveKey = 1
BEGIN
    EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
    EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https://sws.serviceobjects.com/ev3/soap.svc/soap', false
    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'sws.serviceobjects.com'
    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=UTF-8'
    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '"https://www.serviceobjects.com/IEV3Library/ValidateEmailAddress"'
    EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength
    EXEC sp_OAMethod @obj, 'send', NULL, @requestBody
    EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT
    EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT
    EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT
              
    --Checks the Response for a fatal error or if null.
    IF @response IS NULL
    BEGIN
        EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
        EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', 'https://swsbackup.serviceobjects.com/ev3/soap.svc/soap', false
        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'HOST', 'swsbackup.serviceobjects.com'
        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=UTF-8'
        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', '"https://www.serviceobjects.com/IEV3Library/ValidateEmailAddress"'
        EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @requestLength
        EXEC sp_OAMethod @obj, 'send', NULL, @requestBody
        EXEC sp_OAGetProperty @obj, 'Status', @responseCode OUTPUT
        EXEC sp_OAGetProperty @obj, 'StatusText', @statusText OUTPUT
        EXEC sp_OAGetProperty @obj, 'responseText', @response OUTPUT
    END
END