This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difficulty in sending a post request to webserv  RSS feed

 
Sudhir Boddu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello...

In my project work I was supposed to automatically login and create a ticket to a support system. here are the steps I planned to follow

1. Get HTML content of login page by using Get method with HttpsURLConnection.
2. Parse HTML content using jSoup library and extract form input elements.
3. Get the names of the attributes of the form and prepare a parameter list with custom data (like user name, Password) and remaining application generated parameters.
4. Now Send a post request to Login page url with the parameter list ( which also will have other paremeters which are not supposed to be changed).
5. After post request successful I receive the HTML content of page which occurs after login via BufferedReader with InputStream Object of HttpsURLConnection.
6. Now I will send a "GET" request to the page which has a Ticket opening form and receive HTML content of the page.
7. Parse HTML content using jSoup library and extract form input elements.
8. Get the names of the attributes and preapare a parameter list (which will have the details of ticket which needs to be updated and submitted to webservice to complete ticket creation) this should be a multipart form data ( I set headers accordingly).
9. Then post it to the ticket creation web service.
10. Process will complete If a ticket gets created.

Currently

I am able to successfully login to the website, get the parameters and set all the attributes and formdata. but I'm stuck with few errors. Currently I'm getting InvalidStateException : Already Connected error.

I am running the code on IntelliJ IDEA 14 Community Edition. Can anyone please help me with this error. and also it would be great if you can correct me if I'm going in wrong direction to get what I'm trying to do here.

Lines - 448 through 453 of the file.


Thanks in Advance,
Sudhir.
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
StackTrace or nothing happened ;).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!