Create pass through java web service

1.7k views Asked by At

I'm new here and I have a question about java web services.

At work a client told us that he has 2 web services, A and C, basically A sends data via web service to C and C returns response after some processing. But since both have https/http incompatibility, we were told to create a B java web service that will receive data from A (https) and send it to C (http). Right now all I've been told is that this B will consume the WSDL's and resend the data to C, then B will receive C's response and send it back to A (basically a pass through web service).

I'm new to Java web services and I've been watching videos about how to create web services and web services clients but I'm not really sure of what is the right combination/relationship of class/servlet/service that will be needed for this project. I'm not trying to make you guys do my project, I just want some basic knowledge about the purpose of the objects I will need.

1

There are 1 answers

0
muasif80 On

When you do a call to Webservice B from Client A, It is Webservice B that is all that Client A needs to know about.

Now Webservice B can do anything to serve Client A. It can forward request to another service, it can access a database, it can read some data from files etc. All it has to is build a useful response in the end of this processing that it will send back to Client A.

So just consume Webservice C inside Webservice B to fulfill the interface contract that Webservice B provides to client A. All this will be transparent to Client A. Client A will not know anything how Webservice B has come up with the end response it sends back to Client A.

The two artifacts you need to create are.

  1. Implement Webservice B (which can internally call Webservice C to fulfill its job)
  2. Implement a Webservice Client 'A' for Webservice 'B' (This will invoke Webservice B and has no concern whatsoever how Webservice does its job)

For implementation of webservices, you can annotate an stateless session bean as a Webservice. It will expose its methods as Webservice endpoints. Inside these methods you can implement the business logic to invoke Webservice C methods.