Reply
Visitor
JasonE503
Posts: 1
Registered: ‎12-21-2011

Service Operation Identification Failure

I'm using a php wrapper to handle 'basic' constantcontact operations.  I can add users successfully, but if the user is already on the list, to avoid the 409 exception I've tried either updating the contact, or deleting it and then adding it.  In both scenarios, I got this fault.  

 

Constant Contact HTTP Request Exception: <fault>
<faultstring>Service Operation Identification Failure</faultstring>
<detail>
<errorcode>26110</errorcode>
<trace>
Fault Name: ServiceOperationIdentificationFailure
Error Type: Default
Description: Service Operation Identification Failure
Service: LoadBalancer_HTTP_Check
Endpoint: loadbalancer_client
Operation (Client):
</trace>
</detail>
</fault>

 

Again, I get that when I try to update or delete the contact.  Below is the code I'm using ... this seems to be an odd error message I hope you can reveal what is going on.  Also, we are running Apache 2 servers, and I have the same issue whether on the development server or on my own local working copy.  Thanks for your help.

 

<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/include/ConstantContact/ConstantContact.php');
$username = ********;  // These are all set to the right values
$password = *********;
$apiKey = ************;
$consumerSecret = *************************;
$Datastore = new CTCTDataStore();
$DatastoreUser = true;

if($DatastoreUser){

$ConstantContact = new ConstantContact('basic', $apiKey, $username, $password);
$ContactLists = $ConstantContact->getLists();

if(isset($_POST['email'])){
$Contact = new Contact();
$Contact->emailAddress = $_POST['email'];
$Contact->firstName = $_POST['first_name'];
$Contact->lastName = $_POST['last_name'];
foreach($ContactLists['lists'] as $list) {
if ($list->name == "Newsletter")
$Contact->lists = array($list->id);
}

$Exists = $ConstantContact->searchContactsByEmail($_POST['email']);
if ($Exists)
$DeleteContact = $ConstantContact->deleteContact($Exists[0]);
$NewContact = $ConstantContact->addContact($Contact);
if ($Exists && $NewContact)
echo 'update';
elseif ($NewContact)
echo 'add';
else
echo 'failure';
}
} else {echo ' Click <a href="/include/ConstantContact/example_verification.php?apiKey='.$apiKey.'&secret='.$consumerSecret.'&return='.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].'">here</a> to authorize';}
?>

DaveBerard
Posts: 1,635
Topics: 7
Kudos: 61
Solutions: 58
Registered: ‎06-19-2008

Re: Service Operation Identification Failure

It sounds like you're getting this error when either doing deleteContact() or updateContact() methods from the PHP wrapper.  These two methods use the HTTP DELETE and PUT verbs, which is how they differ from all the other requests you mentioned (which all use the GET and POST verbs).  I've seen this error 2-3 times before and it was always in how the requests were being sent to Constant Contact from the sender server.

 

Would it be possible for you to provide a copy of (or access to) your php configuration for your server so we can look at how you have everything set up?  It's like that something in the way the Curl requests are being created and sent for DELETE and PUT requests is causing our load balancer to not be able to process the request.

Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant
EvanS2
Posts: 3
Registered: ‎01-16-2012

Re: Service Operation Identification Failure

@DaveBerard I PM'd you my server config. I have a similar issue.

DaveBerard
Posts: 1,635
Topics: 7
Kudos: 61
Solutions: 58
Registered: ‎06-19-2008

Re: Service Operation Identification Failure

Thanks for the information.  I did send it on to our developer support team to look into, they should be reaching out to you soon about this.  Are you running the same code as the previous poster and getting the same error?  If not, can you post your code and show where the error is being thrown?  Please remember to hide any sensitive information prior to posting.

Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant
EvanS2
Posts: 3
Registered: ‎01-16-2012

Re: Service Operation Identification Failure

My test code is quite similar.

 

<?php
    session_start();
    
    include_once('../ConstantContact.php');

    //    Basic authentication login
    $username = 'XXX';
    $apiKey = 'XXX';
    $consumerPassword = 'XXX';
    $ConstantContact = new ConstantContact('basic', $apiKey, $username, $consumerPassword);
    
    //    Add person to list
    $Contact = new Contact();
    $Contact->emailAddress = 'email_already_in_CC_list@foo.com';
    $Contact->firstName = 'Foo';
    $Contact->lastName = 'Burger';
    $Contact->lists = array('id_removed_for_security_purposes');

    $email_in_list = $ConstantContact->searchContactsByEmail($Contact->emailAddress);
    if(is_array($email_in_list) && !empty($email_in_list))
    {
        $UpdatedContact = $ConstantContact->updateContact($Contact);
       //    Comment the above line and the error goes away.
    }
?>

DaveBerard
Posts: 1,635
Topics: 7
Kudos: 61
Solutions: 58
Registered: ‎06-19-2008

Re: Service Operation Identification Failure

Which line is causing the error, the search or update?

Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant
EvanS2
Posts: 3
Registered: ‎01-16-2012

Re: Service Operation Identification Failure

The update. I can make the code work if I add a new contact instead, but updating does not work.

DaveBerard
Posts: 1,635
Topics: 7
Kudos: 61
Solutions: 58
Registered: ‎06-19-2008

Re: Service Operation Identification Failure

Was finally able to reproduce this internally using your code.  After much debugging and work on our end, turns out that it was actually a simple error in the PHP code that I missed.  It turns out, the library is trying to do a PUT request when updating $Contact to the root URL (https://api.constantcontact.com) because you never updated $Contact with the information you retrieved in $ConstantContact->searchContactsByEmail().  The wrapper created the wrong PUT URI based on this incomplete information which caused you to see this very strange error.

 

First off, a code fix for you is simply this:

 

<?php
    session_start();
    
    include_once('../ConstantContact.php');

    //    Basic authentication login
    $username = 'XXX';
    $apiKey = 'XXX';
    $consumerPassword = 'XXX';
    $ConstantContact = new ConstantContact('basic', $apiKey, $username, $consumerPassword);

    $email_in_list = $ConstantContact->searchContactsByEmail($Contact->?emailAddress);
    if($email_in_list==false)
	{
		// Email isn't in your list, you should create a new contact here
		//    Add person to list
		$Contact = new Contact();
		$Contact->emailAddress = 'email_already_in_CC_list@foo.com';
		$Contact->firstName = 'Foo';
		$Contact->lastName = 'Burger';
		$Contact->lists = array('id_removed_for_security_purposes');
		$ConstantContact->addContact($Contact);
	}else{
		// Email is in your list, you should update with the new information you just collected
		$email_in_list->emailAddress = 'email_already_in_CC_list@foo.com';
		$email_in_list->firstName = 'Foo';
		$email_in_list->lastName = 'Burger';
		$email_in_list->lists = array('id_removed_for_security_purposes');
        $UpdatedContact = $ConstantContact->updateContact($email_in_list);
    }
?>

 

 

Second, we are going to investigate the error message we throw when you make a request against a bad endpoint.  This error we're returning is definitely not useful and was very difficult to trouble shoot even internally.  We'll hopefully have an update to this error in the future to provide a valid error message.

 

 

Dave Berard
Senior Product Manager, Constant Contact
Visitor
NicolasG8
Posts: 1
Registered: ‎05-21-2012

Re: Service Operation Identification Failure

I also ran into that error today:

- thanks Dave for a clear explanation on how to fix it

- there however still is the crytic error message ... glad the search works well on these forums!