I am trying to get into the RETS system using ColdFusion.
At this point I have been able to send a login request using the following code:
<cffunction name="getAuthenticated" access="public" returntype="any">
<cfargument name="userName" type="string" required="yes">
<cfargument name="password" type="string" required="yes">
<!--- First request to get Authenticate Information --->
<cfhttp url="http://rets.offutt-innovia.com:8080/nne/login?rets-version=rets/3.0" method="get" username="#ARGUMENTS.userName#" password="#ARGUMENTS.password#">
<cfhttpparam name="Accept" type="header" value="text/xml,text/plain;q=0.5">
<cfhttpparam name="User-Agent" type="header" value="wsdl">
<cfhttpparam name="RETS-Version" type="header" value="3.0">
<cfset tempCookie = cfhttp.Responseheader["Set-Cookie"]>
<cfcookie name="JSESSIONID" value="#getAuthenticated('myusername','mypassword')#" expires="never">
<cfdump var = "#JSESSIONID#">
Open in new window
When I run the file I get the following response:
D157AAE; Path=/nne/; HttpOnly
So I have the request authenticated, but being a SOAP based system - I have no clue how to continue passing the authentication back and forth to the site to make calls to their system.
I truly have no understanding of SOAP or using stateless requests like this. I only got the code above to work because I found it on another support ticket.
My first attempt was to place the following after the initial code:
<cfhttp url="http://rets.offutt-innovia.com:8080/nne/getmetadata?Type=METADATA-TABLE&ID=Property:ResidentialProperty" method="get" >
<cfdump var="#cfhttp#" />
Open in new window
And I get back great big 401 Unauthorized response code. If I dump the initial function cfhttp - I get a status code 200 OK
Can anyone help me get to the next step of being able to use the login authentication to start making requests on the system?
I am looking for actual code help as well as theory and understanding. However I learn the best from code samples. I like to pull things apart and see how they work then put them together again :)
For reasons too long to go into - I am on a 15 day time crunch to get this done. As always - help is greatly appreciated.
Edit: Sorry I'm working on a deadline myself and obviously I didn't fully read your question :/ Apologies I don't have time for a fuller response but ...
> <cfcookie name="JSESSIONID"
Actually that just sets a cookie in your browser, it has no effect on the cfhttp call. Since cfhttp is sort of like a mini-browser, you need use <cfhttparam type="cookie" ...> to set a cookie for the cfhttp request.