Java WebService (Rest/SOAP) Design Pattern - web-services

We have an application built using Springs/Hibernate/Springs-MVC/.
Now we want to provide RESTful services, planning to use Springs MVC. My question is, is it better to expose the service API directly as Rest Service or write a new Pojo Layer on top of the Service Layer and expose that ?
Will appreciate your insights. Thanks.

I am pretty sure you would want to have a top layer so you can only expose what you want to expose from your Web Service to the outside.

Related

How can I expose a WSDL using Mulesoft so Salesforce can call it

I'm new to the Mulesoft. Currently we have a requirement that need to use Mulesoft to expose a WSDL for Salesforce to call. When Salesforce call this web service, it will transform some account information and Mulesoft will load them to a MySQL table. Could anyone help how can I create this? Thank you!
Definitely... As Nuno said you need to use CXF component in Mule to expose your SOAP webservice.. Actually using Mule platform you can able to expose any kind of Web Service you required like (Soap,Rest) that other applications can able to read ..
Take a look into an easy way of creating the webservice and exposing the WSDL :- http://training.middlewareschool.com/mule/soap-code-first-build/
To publish a SOAP service you should use the CXF component (reference). Take a look into the documentation Publishing a SOAP API to have an ideia in how to begin your flow.
Please take some time to have a quick look into the Mule User guide, since it explains the essentials to start developing with Mule. You will need it to learn how to interact with MySQL too (Database connector).

Login/Registration functionality in cq5

I need to create register/login functionality in CQ5. There are three ways
1 - The register/login functionality should be prepared as web service hosted on a Java Application Server and then we can consume data from web services.
2 - The functionality should be prepared as web service based on RESTFull that hosted on CQ itself since AEM is developed around the REST principal and REST web services is certainly one which will be supported. So I believe RESTfull web services can be hosted with CQ5.
3 - Why do we need web services? I do not think it requires web services since my application is not going to communicate with other application and it dont want to expose any services to outside world. Why don't we create register/login functionality as we do in normal web application. Can we create a OSGI bundle that invoke databases to store user details for register/login functionality?
I would go for 3rd option but my concern is AEM is not the place to build our business logic to carry out functions that are not related to content rendering.
which option would you choose and why? Kindly share your ideas and thoughts. I am just looking for best solution to develop register/login functionality in CQ.
Thanks
I think i am late to the party but it might help someone. Yes, you can very well create rest webservices in CQ and they work well. So, you can take that approach.
The way to go about implementing login/registration would be how it is done OOTB but OOTB is also bad in the way it implements it so you have to make modifications to overcome that.
1) You need to register and Authentication handler with CQ. If you are looking for a sample there is a form authentication handler source that you can look at.
2) We have integrated out Auth handler with Active Directory (AD). Since AD is supported by default, so it is easy to integrate with Auth Handlers.
3) Next you need to create a user login token for which you can look into TokenUtil class of CQ or if you are looking to develop SSO, you can look into SSO code that is packaged OOTB.

Strategy to develop a web service in JAX WS

i'd like your help to designing a wb serice but I don't know how i can't do this.
In fact my application handles data management clients. My application is developped in struts 1.0, spring, weblogic and build-in maven.
He was asked to me to make an evolution because an external application need to access data such as displaying the address of the client or displaying data bank. For this, it was planned to create a web service to retrieve in real time.
I would like to know the strategy to use for designing a web service. Do I need to create a new Dynamite projet maven + JAX WS to my web service and deploy my war on my weblogic server?
Or they have something else to do ?
Thanks a lot !
I am not sure that this question is related to maven.
Adding a WebService (or RestService) could be quite easy with springframework and apache cxf (http://cxf.apache.org/)
see jaxws or jaxrs for more.
create web service in a two types but real time applications using jax-ws web services reason for consumer want to send data into provider.consumer can know the entire information about the provider by seeing its WSDL Document.

What is the easiest and most simple way of creating webservice (SOAP) using Spring?

i am not familiar with the most optimal and easy way on how to develop webservices using Spring. We are going to use Tomcat as our application container, so i was wondering what the most easy way would be to develop webservices using Spring running on Tomcat? Should i use CXF/Axis or something else? We are planning to use the code-first approach.
Currently we already have some nice Spring beans as services and it would be great if we could expose them as SOAP endpoints.
If you use code first, I would suggest Apache CXF with the jax-ws front end or the simple front end
The JAX-WS version is more powerful, but the Simple Frontend decouples your code from the framework (you don't need to annotate your services). Both are simple to create and work reliably.

EJB 3 | Entities with webservices

I want to access a inventory system which is accessible through webservice, What is the best way to integrate, I thought of directly expose the entity facade as a web service using #WebSerive it's possible but don't know whether it's a good approach or not, need some advice.
Thanks.
You could eventually define the methods to be exposed in the same class (or maybe create a wrapper).
My understanding is that you want to consume a web service i.e. to implement a web service client. My recommendation would be to use JAX-WS for this. See :
A Simple JAX-WS Client in the Java EE 5 Tutorial
Developing JAX-WS Web Service Clients