Runtime Error -2147467260 (80004004) with xml put

mjcaestecker

Registered User.
Local time
Today, 03:44
Joined
Aug 17, 2012
Messages
25
greetings all,

I've encountered this runtime error when trying to put an xml file to constant contact's encrypted file server. I'm relatively sure it is an access issue, but really have no clue how to fix it. Below is the code i'm using with an xml 6.0 reference. The line the error occurs on is near the bottom in red.

Code:
Private Sub Command3_Click()
    Dim Execute As New MSXML2.XMLHTTP60
    Dim xml As String
    
    xml = "<entry xmlns=""http://www.w3.org/2005/Atom"">" & vbCrLf
    xml = xml & "<link href=""/ws/customers/account/contacts/0000"" rel=""edit""></link>" & vbCrLf
    
    xml = xml & "<id>http://api.constantcontact.com/ws/customers/account/contacts/0000</id>" & vbCrLf
    xml = xml & "<title type=""text"">Contact: martin@gl.com</title>" & vbCrLf
    xml = xml & "<updated>2012-12-27T04:41:34.587Z</updated>" & vbCrLf
    xml = xml & "<author>" & vbCrLf
    xml = xml & "<name>Constant Contact</name>" & vbCrLf
    xml = xml & "</author>" & vbCrLf
    xml = xml & "<content type=""application/vnd.ctct+xml"">" & vbCrLf
    xml = xml & "<Contact xmlns=""http://ws.constantcontact.com/ns/1.0/"" id=""http://api.constantcontact.com/ws/customers/account/contacts/0000"">" & vbCrLf
    xml = xml & "<Status>Active</Status>" & vbCrLf
    xml = xml & "<EmailAddress>martin@gl.com</EmailAddress>" & vbCrLf
    xml = xml & "<EmailType>HTML</EmailType>" & vbCrLf
    xml = xml & "<Name>Martin</Name>" & vbCrLf
    xml = xml & "<FirstName>Martin</FirstName>" & vbCrLf
    xml = xml & "<MiddleName></MiddleName>" & vbCrLf
    xml = xml & "<LastName></LastName>" & vbCrLf
    xml = xml & "<JobTitle></JobTitle>" & vbCrLf
    xml = xml & "<CompanyName></CompanyName>" & vbCrLf
    xml = xml & "<HomePhone></HomePhone>" & vbCrLf
    xml = xml & "<WorkPhone></WorkPhone>" & vbCrLf
    xml = xml & "<Addr1></Addr1>" & vbCrLf
    xml = xml & "<Addr2></Addr2>" & vbCrLf
    xml = xml & "<Addr3></Addr3>" & vbCrLf
    xml = xml & "<City></City>" & vbCrLf
    xml = xml & "<StateCode></StateCode>" & vbCrLf
    xml = xml & "<StateName></StateName>" & vbCrLf
    xml = xml & "<CountryCode></CountryCode>" & vbCrLf
    xml = xml & "<CountryName></CountryName>" & vbCrLf
    xml = xml & "<PostalCode></PostalCode>" & vbCrLf
    xml = xml & "<SubPostalCode></SubPostalCode>" & vbCrLf
    xml = xml & "<Note></Note>" & vbCrLf
    xml = xml & "<CustomField1>1234567890</CustomField1>" & vbCrLf
    xml = xml & "<CustomField2></CustomField2>" & vbCrLf
    xml = xml & "<CustomField3></CustomField3>" & vbCrLf
    xml = xml & "<CustomField4></CustomField4>" & vbCrLf
    xml = xml & "<CustomField5></CustomField5>" & vbCrLf
    xml = xml & "<CustomField6></CustomField6>" & vbCrLf
    xml = xml & "<CustomField7></CustomField7>" & vbCrLf
    xml = xml & "<CustomField8></CustomField8>" & vbCrLf
    xml = xml & "<CustomField9></CustomField9>" & vbCrLf
    xml = xml & "<CustomField10></CustomField10>" & vbCrLf
    xml = xml & "<CustomField11></CustomField11>" & vbCrLf
    xml = xml & "<CustomField12></CustomField12>" & vbCrLf
    xml = xml & "<CustomField13></CustomField13>" & vbCrLf
    xml = xml & "<CustomField14></CustomField14>" & vbCrLf
    xml = xml & "<CustomField15></CustomField15>" & vbCrLf
    xml = xml & "<ContactLists>" & vbCrLf
    xml = xml & "<ContactList id=""http://api.constantcontact.com/ws/customers/account/lists/0"">" & vbCrLf
    xml = xml & "<link xmlns=""http://www.w3.org/2005/Atom"" href=""/ws/customers/account/lists/0"" rel=""self""></link>" & vbCrLf
    xml = xml & "<OptInSource>ACTION_BY_CUSTOMER</OptInSource>" & vbCrLf
    xml = xml & "<OptInTime>2012-12-20T21:35:27.758Z</OptInTime>" & vbCrLf
    xml = xml & "</ContactList>" & vbCrLf
    xml = xml & "</ContactLists>" & vbCrLf
    xml = xml & "<Confirmed>true</Confirmed>" & vbCrLf
    xml = xml & "<InsertTime>2012-12-20T21:35:27.492Z</InsertTime>" & vbCrLf
    xml = xml & "<LastUpdateTime>2012-12-20T22:41:34.587Z</LastUpdateTime>" & vbCrLf
    xml = xml & "</Contact>" & vbCrLf
    xml = xml & "</content>" & vbCrLf
    xml = xml & "<source>" & vbCrLf
    xml = xml & "<id>http://api.constantcontact.com/ws/customers/account/contacts</id>" & vbCrLf
    xml = xml & "<title type=""text"">Contacts for Customer: account</title>" & vbCrLf
    xml = xml & "<link href=""contacts""></link>" & vbCrLf
    xml = xml & "<link href=""contacts"" rel=""self""></link>" & vbCrLf
    xml = xml & "<author>" & vbCrLf
    xml = xml & "<name>account</name>" & vbCrLf
    xml = xml & "</author>" & vbCrLf
    xml = xml & "<updated></updated>" & vbCrLf
    xml = xml & "</source>" & vbCrLf
    xml = xml & "</entry>" & vbCrLf
    
    'MsgBox xml

    Execute.Open "PUT", "https://api.constantcontact.com/ws/customers/account/contacts/0000", False, username, password
    Execute.send (xml) [COLOR="Red"]** Runtime Error -2147467260 (80004004) occurs here on this line **[/COLOR]
    MsgBox Execute.responseText

    Set Execute = Nothing
End Sub
 
What happens if you remove the parenthesis?
Code:
Object.Send xml
 
Returns the same error message. Is it possible that the Object.send command does not like a string as input?
 
PUT is usually an FTP command, have you tried using POST?
 
Constant contact specifies that you use Put instead of Post for contact update. I did manage to solve the problem, however. Just needed to create an MSXML2.DOMDocument with a loadXML (str) command. I sent that and it worked. Thanks for the suggestions, though!
 

Users who are viewing this thread

Back
Top Bottom