简体   繁体   中英

web service and web application

I am new to web serivce. I have written a few clients using AXIS2 but nothing more. Now I have to create some service that will be consumed by others. We have a web application written using wicket.

Does my webservice need to be a part of the web application. Can it be a deployed seperately, but still use the same code that is used by the web application.

any tips of how to start including security, authentication etc. Any reference to reading material, tutorial is greatly appreciated.

Taking the questions one at a time:

  1. Does the webservice need to be part of the web application? No. It can be a completely separate project with it's own deployment.

  2. Can it be deployed separately? Yes, see #1.

  3. Can it use the same code as the web app? Yes. This is a matter of how you reference the web app. You might consider branching the code, or just building it in to the web app to begin with.

A couple of resources:
RESTful webservices with Wicket
Web service API for Wicket

Bear in mind, I've never used wicket before so I have no idea if the above links are worthwhile.

Regarding security. You usually provide a web api "key" of some sort to your clients. That key is then passed in to every api call which you then validate for both authentication and authorization. This is how most systems work.

Also, just like with web apps, the calls to the API should go over an SSL connection in order to try and prevent anyone from eavesdropping on the conversation.

As far as logging, this is no different than logging you would set up for a normal web app. There are plenty of logging tools out there like log4j .

Short answer: Generically, yes, you can deploy your web service as part of your web application. You should think of your web service as another "view" on your business logic. If you have followed good patterns (eg putting your business logic in a library, not controllers) this shouldn't be too hard.

You may want to "enforce" this by putting shared business logic in one library, and then split the web service and web application into another project.

There are really too many options for web services to list them all, but here's a place to look as a tutorial:

http://static.springsource.org/spring-ws/sites/1.5/reference/html/tutorial.html

Follow the below link that explains how to expose your ASP.Net web application functionality as a web service. The below article takes TrendsInInvestment web application to explain the procedure.Features like authentication,caching and pagination has been included while implementing web service.

1)Link for article. http://securityresearch.in/index.php/tutorials/how-to-expose-your-asp-net-web-application-functionality-as-awebservice

2)Link for the modified web application,web service and its sample code . http://securityresearch.in/index.php/projects/f_security/trends-in-investment-web-service-1-0-is-now-available

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM