• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Replacing SOAPUI with Java

 
Ranch Hand
Posts: 170
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?



Thanks,

Kevin
 
Saloon Keeper
Posts: 6888
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How, specifically, does it not work?

This kind of automation might be possible with JMeter, but I'm not sure it has facilities for dealing with certificates. You may have to install those in the JDK's certificate store.
 
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Building your own requests by hand is not a good idea, especially not if they are complicated, as SOAP tends to be.

You should be using a JAX-WS implementation to send SOAP requests. I've had good experiences with Glassfish Metro.

If you come across it, avoid Axis2 like the plague. It's a terrible framework that will end up costing you more than it's worth.
 
kevin Abel
Ranch Hand
Posts: 170
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
kevin Abel
Ranch Hand
Posts: 170
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
.afterConnect(unkown source)

sun.net.www.protocol.http.HttpURLConnecion.getOutputStream(Unknown Source)
...(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
taxiePOstRequest()

Thanks,
Kevin
 
Marshal
Posts: 3457
493
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a bit confused.  There is mention of SOAP and XML, but I don't see anything related to SOAP or XML in your example code.
 
Ron McLeod
Marshal
Posts: 3457
493
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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) ?
 
Ron McLeod
Marshal
Posts: 3457
493
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
kevin Abel
Ranch Hand
Posts: 170
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ron,
What I want to do is replace the SOAPUI utility.
I'd like to supply:
URL
BODY
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.

Thanks,

Kevin
 
Hold that thought. Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic