Email Validation 3 C# Code Snippet

//Add a service to your application https://trial.serviceobjects.com/nl/ncoalive.asmx?WSDL
DOTSNCOALive NCOAClient_Primary = new DOTSNCOALive();
NCOAAddressResponse response = NCOAClient_Primary .RunNCOALive(addresses, JobId, LicenseKey);
          
if (response.Error != null)
{
    //Process Error
}
else
{
    //Process Response     
}

Email Validation 3 Java Code Snippet

NCOAResult validatedInfo = null;
Error error = null;
// Create soap request
DOTSNCOALiveLocator locator = new DOTSNCOALiveLocator();
// use ssl
locator.setDOTSNCOALiveSoapEndpointAddress("https://trial.serviceobjects.com/nl/ncoalive.asmx?WSDL");
DOTSNCOALiveSoap soap = locator.getDOTSNCOALiveSoap();
soap.setTimeout(5000);
validatedInfo = soap.runNCOALive(addresses, jobId, key);
error = validatedInfo.getError();
if(resp == null || (error != null && error.getTypeCode() == "3"))
{
    throw new Exception();
}
   
//Process Results
if(error == null){
    //DOTS NCOA Live Results   
}
//Process Errors
else{
    //DOTS NCOA Live Error Results 
}

Email Validation 3 PHP Code Snippet

<?php
// Set these values per web service <as needed>
$wsdlUrl = "https://trial.serviceobjects.com/nl/ncoalive.asmx?WSDL";
  
$params['Addresses']    = $Addresses;
$params['JobId']        = $JobId;
$params['LicenseKey']   = $LicenseKey;
  
$soapClient = new SoapClient($wsdlUrl, array( "trace" => 1 ));
$result = $soapClient->RunNCOALive($params);
if (!isset($result->NCOAResultItem->Error)) {
    foreach($result->NCOAResultItem->NCOAResults $k=>$v) {
        echo $k . ", " . $v;
    }
} else {
    foreach($result->NCOAResultItem->Error as $k=>$v) {
        echo $k . ", " . $v;
    }
}
?>

Email Validation 3 RoR Code Snippet

#Formats inputs into a hash to pass to Soap Client
    #Hash Keys must be named as they are shown here.
    message =   {
                    "LicenseKey" => @request.licensekey,
                }
  
    #Implemented to make the code more readable when accessing the hash        
    @ncoaresponse = :get_job_summary_report_response
    @ncoaresult = :get_job_summary_report_result
    @ncoajobs = :jobs
    @ncoajobinfo = :job_info
    @ncoaerror = :error
  
    #Set Primary and Backup URLs here as needed
    dotsNCOAPrimary = "https://trial.serviceobjects.com/nl/NCOALive.asmx?WSDL"
    dotsNCOABackup = "https://trial.serviceobjects.com/nl/NCOALive.asmx?WSDL"
    @displaydata = Hash.new()
    begin
        #initializes the soap client. The convert request keys global is necessary to receive a response from the service.
        client = Savon.client(wsdl: dotsNCOAPrimary)
        #Calls the operation with given inptus and converts response to a hash.
        response = client.call(:get_job_summary_report, 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 backup url and attempt to retrieve data.
    rescue Savon::Error => e
        begin
        backupclient = Savon.client(wsdl: dotsNCOABackup)
        #Sets the response to the backclient call to the operation and converts response to a hash.
        response = backupclient.call(:get_job_summary_report, message: message).to_hash
        processresults(response)
  
        #If backup url 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

Email Validation 3 Python Code Snippet

mLicenseKey = LicenseKey.get()
if mLicenseKey is None or mLicenseKey == "":
    mLicenseKey = " "
#Set the primary and backup URLs as needed
primaryURL = 'https://trial.serviceobjects.com/nl/NCOALive.asmx?WSDL'
backupURL = 'https://trial.serviceobjects.com/nl/NCOALive.asmx?WSDL'
#This block of code calls the web service and prints the resulting values to the screen
try:
    client = Client(primaryURL)
    result = client.service.GetJobSummaryReport(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.GetJobSummaryReport(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)

Email Validation 3 Code Snippet

<!--Makes Request to web service --->
<cfscript>
        try
        {
            if (isDefined("form.Action") AND Action neq "")
            {
                wsresponse = CreateObject("webservice", "https://sws.serviceobjects.com/nl/ncoalive.asmx?WSDL");                           
                outputs = wsresponse.getJobSummaryReport("#LicenseKey#");
                writedump(outputs.getError());
            }
        }
    catch(any Exception){
        try
            {
                if (isDefined("form.Action") AND Action neq "")
                {
                    wsresponse = CreateObject("webservice", "https://sws.serviceobjects.com/nl/ncoalive.asmx?WSDL");                           
                    outputs = wsresponse.getJobSummaryReport("#LicenseKey#");
                }
            }
            catch(any Exception)    {
                 writeoutput("An Error Has Occured. Please Reload and try again");              
                }
        }
</cfscript>

Email Validation 3 Visual Basic Code Snippet

Try
    Dim ws As New NCOA.DOTSNCOALiveSoapClient
    Dim response As NCOA.JobSummaryReportResponse
  
    response = ws.GetJobSummaryReport(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 NCOA.DOTSNCOALiveSoapClient
        Dim response As NCOA.JobSummaryReportResponse
        response = wsbackup.GetJobSummaryReport(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

Email Validation 3 Apex Code Snippet

wwwServiceobjectsCom.JobSummaryReportResponse result;
try{
wwwServiceobjectsCom.DOTSNCOALiveSoap client = new wwwServiceobjectsCom.DOTSNCOALiveSoap();
result = client.GetJobSummaryReport([LicenseKey]);
}
catch(Exception ex){
 //If the first request failed try the failover endpoint
wwwServiceobjectsCom.DOTSNCOALiveSoap backupClient = new wwwServiceobjectsCom.DOTSNCOALiveSoap();
//The backup environment will be provided to you upon purchasing a production license key
backupClient.endpoint_x = 'https://trial.serviceobjects.com/NCOALive/api.svc/soap';
result = backupClient.GetJobSummaryReport([LicenseKey]);
}

Email Validation 3 TSQL Code Snippet

SET @requestBody = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'+
                   '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'+
                   '<GetJobSummaryReport xmlns="https://www.serviceobjects.com">'+
                   '<LicenseKey>' + @key + '</LicenseKey>'+
                   '</GetJobSummaryReport>'+
                   '</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/nl/ncoalive.asmx', 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/GetJobSummaryReport"'
    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/nl/ncoalive.asmx', 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/GetJobSummaryReport"'
        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