web services - apt vs wsgen vs wsimport .Confusion on what to use when and why not to use the other -
i have been trying write web service (jax-ws) , have gone through number of tutorials ranging 2006 2013 ones. of them respect ide. talk manual creation/deployment of web service ant scripts. till here fine.
the moment check ant scripts, confusion starts. old tutorials use apt task compile sei , wsgen used generate artifacts. newer ones use wsgen (although apt defined taskdef in ant scripts). , have been reading java 7 documentation, says dont need use wsgen javac compilations , artifacts req. ws generated @ runtime dynamically.
i tried use javac command on sei , deployed on tomcat didnt work.
can please clarify in commands need use in java se 7 edition deploy web service.
also, want know each command generate , when use commands.
according knowledge wsimport not needed development , deployment , need build ws-client. correct? if not please provide me pointers clear understanding.
thanks in advance
also if repeat self sorry new stackoverflow , not familiar this. :)
to create web service using java-ws specification, need several artifacts. purpose of apt
, wsgen
, wsimport
automate procedure.
there 2 ways create web service: bottom-up (first code, wsdl) , top-down (first wsdl code).
buttom-up approach:
- apt: uses source code, generates wsdl (and artifacts)
- wsgen: uses compiled code, generates wsdl (and artifacts)
top-down
- wsimport: uses wsdl, generates java code service/client implementation.
the advantage of using apt having source code script able parameters names , use them on wsdl.
web service deployment
for production need web container can in charge of security, scalablity , resource management, however, testing porpouses can deploy web services using built-in web server on java se doing:
@webservice public class myservice{ public static void main(string args[]){ myservice service = new myservice(); string url = "service/"; endpoint ep = new endpoint(url, service); } @webmethod public string getinfo(){ return "service info"; } }
this piece of code generate wsdl , publish service @ localhost/service.
Comments
Post a Comment