0

I'm trying to recover the XML from Content Server from Opentext using url. This is part of the code I'm using. wURL is : https://company.domain/company/cs.exe/?func=ll&objId=999999&objAction=xmlexport.

Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.Open "GET", wURL, False    
objXMLHTTP.Send 

xmldoc.Load objXMLHTTP.responseXML
Set xmlNodeList = xmldoc.getElementsByTagName("llnode")

I get this response :

?objXMLHTTP.responsetext = 
 <html><body onload="document.forms[0].submit()"><noscript><p><strong>Note:</strong> Since your 
 browser does not support JavaScript,you must press the Continue button once to proceed.</p>        
 </noscript><form action=wURL method="post"><div><input type="hidden" name="OTDSTicket" value="

I found out that if I go to the URL via IE prior to executing the function, it loads the XML just fine into xmlNodeList. I tried to automate the process with an IE object that navigate to the URL but it's not viable since I need to look through 500+ XML and eventually IE returns an automation error.

I think by going to the URL before I call my function, I somehow authenticate or create a connection and thus being able to load the XML. I would like to know if it is possible to recreate that authentication by code in a reliable way.

I also tried :

objXMLHTTP.Open "GET", wURL, False, myUserName, myPW 

with my credentials but it didn't change anything. Thank you.

trixrabbit
  • 259
  • 7
  • 22

2 Answers2

0
objXMLHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"

This tells the server you are IE8 (even though you aren't). Put it before the objXMLHTTP.Send line. Is this sufficient to trick the server?

  • I tried and it didn't work. By the way I'm using IE8. We also have chrome installed. I really don't get the weird javascript not supported reply. I wish I knew what really happens when I send my request. – trixrabbit Nov 28 '14 at 15:45
0

Which version are you on? You should try to use the rest api. Available with update 2014-09.

Steffen Roller
  • 3,464
  • 25
  • 43
  • I tried but couldn't get anything to work..maybe I was doing something wrong I didn't find any guide exept the page they provide for rest api. Content Server 10, Update 9 version 10.0.0.2314 I managed to treat some automation by killing iexplore.exe process when I get an error but still it's sketchy – trixrabbit Dec 01 '14 at 13:56