My current project needs me to enter in hundreds of XML requests to the Web Service. Then manually look at the return value. Up to now I'm using SOAPUI and my 59 1/2 year old eyes and hands know I could be using Java to read off a spread sheet for at least the POSTs.
There is a certificate involved.
I took at stab at the code. Here is the method for the code. After adjusting it for my server and files it does not work.
Can I get a sample of code that uses a certificate?
I can ask the Java developers for assistance but I would like to attempt this on my own first. Is that a good idea or should I just ask them?
Stephan van Hulst...I was working with VBScript a few years ago. Somehow the developer used something such as HttpurlConnection and sent in a Post and received a response. Maybe it was not this utility but I did see a simple way to do a POST and get back a response. A certificate was involved. I think there must be simple code for POST with a response with a certificate involved.
Tim Moores...I can not post the code from work. It looks similar to the code that I posted here.
These are a sampling of the error messages I encounter.
On line (13) THE oUTPUTsTREAM OS = POSTcONNECTION.GEToUTPUTsTREAM(); line gives errors such as:
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
kevin Abel wrote:There is a certificate involved ... Can I get a sample of code that uses a certificate?
Can you expand on this? Do you need to provide a client certificate when POSTing your request? Do you do a have a requirement to work with server certificates which are self-signed (not signed by a trusted CA) ?
kevin Abel wrote:My current project needs me to enter in hundreds of XML requests to the Web Service. Then manually look at the return value.
In your example, it looks like you are attempting to create a resource represented with a JSON structure like this:and then verifying that the response had a status of 201 Created. Are you expecting something back in the response body as well, and does it need to be checked to verify that the resource was actually created?
What I want to do is replace the SOAPUI utility.
I'd like to supply:
Header Items I think that they are called.
certificate information that is required similar to how SOAPUI stores the location and password
Then get back a response in XML. JSON is second choice of return format. Also I'd like to see the status code.
So I want to imitate SOAPUI doing a POST and getting back a code and XML.
I have been on projects where I was supplied a GUI where I put in POST/GET, header and it returned a response and body. It probably had the certificate part built in so I didn't have to deal with it.
I have been guessing at code by doing google searches and trying things that look a bit like what I want to do.
My thinking is that this is a standard thing you Java experts do all of the time.
Once I know it is a 200, I can slice, dice, cut, paste, compare the results to expected. I'm getting good at that part of Java and POI.
Hold that thought. Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners