ColdFusion CFHTTP A message in a remote form does not return a results page, it simply returns an input form

I am using ColdFusion 8. I am trying to use the CFHTTP message to submit a form on this page without entering a number by the user and click Submit. https://testefile.boe.ca.gov/boewebservices/verification.jsp?action=SALES

I have done this before with other forms, this is usually not a problem.

Here is my code:

<cfhttp url="https://testefile.boe.ca.gov/boewebservices/servlet/BOEVerification" method="POST" port="443" resolveurl="yes" redirect="yes"> <cfhttpparam type="FORMFIELD" name="type" value="SALES"> <cfhttpparam type="FORMFIELD" name="account" value="10003"> <cfhttpparam type="FORMFIELD" name="Submit" value="Submit+Request"> </cfhttp> <Cfoutput>#cfhttp.fileContent#</CFOUTPUT> <cfdump var="#cfhttp#"> 

If you try the form manually and enter the account number 10003, it will return the results page https://testefile.boe.ca.gov/boewebservices/verification_results.jsp

But when I use the CFHTTP message, it just returns the input page https://testefile.boe.ca.gov/boewebservices/verification.jsp?action=SALES

One of their developers made a Java page to do the same thing I'm trying to do, and it worked. Unfortunately, I do not know Java.

thanks,

Rich

+4
source share
5 answers

Hi Richard, the reason you are shown the form instead of the expected results is because the verification.jsp template expects you to have a valid session when you hit it to view the results. <cfhttp> does not support native state, so a project like Ben Nadel CFHttpSession.cfc can help. CFHttpSession will manage cookies (and therefore the session) between <cfhttp> calls by interpreting the results of the Set-Cookie header and adding them back on subsequent calls.

Another thing I noticed while looking at the server response headers was that the session cookie (jsessionId) is set to "secure". This means that cookies can only be used by secure connections. I don’t have SSL settings in my test environment, so my attempts to use the Ben object failed, but I think that it has a good chance if you can test it via SSL connection.

Here is a simple test that I used with the Ben project:

 <!--- CFHttpSession does not follow redirects, this is why two calls are needed ---> <cfset objHttpSession = CreateObject("component","CFHTTPSession").Init() /> <cfset objResponse = objHttpSession.NewRequest( "https://testefile.boe.ca.gov/boewebservices/servlet/BOEVerification" ) .AddFormField( "type", "SALES" ) .AddFormField( "account", 10003 ) .AddFormField( "Submit", "Submit+Request" ) .Post()/> <cfset objResponse = objHttpSession .NewRequest( "https://testefile.boe.ca.gov/boewebservices/verification.jsp" ) .get() /> <cfoutput>#objResponse.filecontent#</cfoutput> 

** You may also need to make another http call before the others establish a session before your message.

+2
source

This may be due to the https address. You will probably need to import the certificate into the java key store for a successful connection. Try this post for the process of adding a certificate: http://www.coldfusionmuse.com/index.cfm/2005/1/29/keystore

0
source

I assume that you are getting an input page because the server is redirecting you. Is there anything useful in cfhttp.errordetail if you set the redirect to no?

0
source

So, is the data really transferred to the BOEVerification page or never reach it?

0
source

I had the same problem and added CFID and token to the request: and got my code to work.

0
source

Source: https://habr.com/ru/post/1285764/


All Articles