Webservices :Understanding the task assigned - java

I am a complete newbie to web services and I am working alone. My lead mailed me a task to complete. I think he has hard coded the information and he wants me to replace the hard coded data from web services.
He has mailed me a WSDL file and said
Make the jar file from the wsdl.
What does this mean ?

There are tools which will generate Java code to talk to web services, performing serialization and deserialization effectively, so that your client code can talk in terms of Java objects rather than raw SOAP.
You should find out which of these tools is being used in your project, and apply it to the WSDL provided.
(Also, it's a good idea to get used to asking for more information when you don't understand the assignment. A good team leader - or anyone, really - should be more than happy to help you.)

Generate the Java stubs from the wsdl.
wsdl2Java
wsdl2Java

If you are familiar with eclipse, then the task can be completed easily. I think he is asking for the jar of client stub which can be produced from the wsdl.
In that case do: In eclipse, make sure you have webservices plugin. Follow this after that
You will have few .java files being exported. Try to compile them and generate the .class files. Now jar the .class files using command in command prompt
jar -cvf <Name of the jar>.jar *

Related

Given a JAR file, allegedly contains web server, how do I deploy it?

I've been handed a JAR file, told it contains a web application, and instructed to deploy it. I'm familiar with java as a language, but I have next to no experience with its web ecosystem. Trying to run it as an executable, I find out it has no main class, so I take a look at the contents, and find that it has a META-INF/web-fragment.xml file, along with a couple of Servlet classes and some config files referenced in the xml. It looks like there is basically everything here for a complete application, but I have no idea how to actually deploy it, and google only yields tutorials on how to build these things from scratch with IDEs and deploy using maven plugins and goals.
Assuming that building from source is out of the question and I only have standard unix and java CLI tools available, based on the information provided (And I can provide more if necessary), what is the simplest way to get this up and running?
A web applicaton should be in a WAR file, not a JAR file, and you should only need to just drop it into the webapp directory of your Tomcat, or follow the instructions for whatever other container you're using.
If it's only a fragment, as appears from the XML, (a) it isn't a webapp, only part of one, and (b) you personally can't deploy it at all. You need the whole thing.
Send the assignment back for clarification.

How to set up a system that reads PMML files which I create using R?

For the past few days I'm stuck at trying to pass a PMML file with .xml extension that I created using R and pmml package. After creating a iris.xml PMML file I have no where to go, actually I don't know what to look for. And then I saw Alex Guazzelli's video here, where he tells us to use ADAPA from Zementis to run the PMML files that are created from R.
What I took away from the video is,
I want to do something similar as shown, like uploading my PMML file at some place and input my test files frequently to get the corresponding predicted values.
ADAPA looks great, but looks like it also costs some money. So I would like to look for an alternative, which might not be as user friendly as ADAPA.
Then I found this page where the author says,
So the first step was to get the engine running. I experienced some small problems but Scott fixed them very fast and offered a new war file ready for deployment inside tomcat. It can be obtained under http://code.google.com/p/openscoring/. If you still encounter some problems you could also try my war file. It was built with java version “1.6.0_26” and tested under tomcat 7. After installing the war file using the management console, you could test it by sending a POST request in XML like the following to ‘http://localhost:8080/OpenScoring/Scoring’
Then I found jpmml. The problem here is the package names are very confusing, I don't know which one to install. In fact I don't know how to install each of them. I have basic knowledge of Java, apparently it isn't helpful in the current scenario.
Desperately looking forward for any kind of help.
How do the data flows in your application look like? Zementis' ADAPA is a standalone web service, which lets you do scoring in a request/response fashion. This works for web applications, but is clearly sub-optimal if you're looking to score larger amounts of data.
The JPMML project provides "PMML runtimes" for most popular big data frameworks. For example, if your application is tied to Apache Spark, then you would go for the JPMML-Spark project, if tied to Apache Hive/Pig, then for the JPMML-Pig project, etc. For a simple REST web service you should check out the Openscoring project, which is functionally identical to Zementis' ADAPA.
All JPMML projects can be built from their source checkout using Apache Maven by issuing the following command:
mvn clean install
Some JPMML projects also have their binaries distributed via the Maven Central repository. If you're looking for the Openscoring WAR file, then you need to search for "openscoring-webapp" and on the results page click the "download WAR" link (at the time of writing this, you would get openscoring-webapp-1.2.12.war). This is a standard WAR file that can be dropped to the auto deploy folder of your favourite Java web server (Tomcat?) as it is. The REST API of the web service is fully documented in the README file of the Openscoring project.

Converting War to .exe / Testing Restful Webservice

I am a newbie to this Rest Web Services.
This question is already posted. But I cannot understand a thing. I have two questions here.
When we created a WebApp with soap web services, we generated a test client to test it. Is there a way we can test Rest Webservices? (Using Eclipse IDE, Generated test client in the following way.
File---> new---> other---> web service---> web service client. So, now how can i test Restful web services? (I found one Rest Client tool, but I dont understand how to use that (Newbie :) ).
I need to find a way to give our war file to client as .exe file. I didn't understand what exactly that meant, but here is the requirement.
"We need to give our client this in the form of .exe file, like whenever we download some .exe file, it will ask us to Run, Accept license, Browse destination, and such things. And also he shouldn't be able to see our code."
This is what exactly our senior management told me and Is there a way we can make it possible??
(I showed him the InstallJammer and then he said the client shouldn't see the code.)
For Question 2:
See some packaging tool like NSIS or IzPack or InnoSetup

Can I change the Java package of a WebService Client?

So, my JAVA application is connected to different WebServices that were developed inhouse and all 3 of them are packaged under org.tempuri
This is the default namespace I believe and when the wizard creates the Java packages it places them under org.tempuri..
I wanted to change them to give them meaningful names but then my app exploded :(
Can I just go into the .wsdl and change the namespace and repackage it all? Or some way that I can change package "org.tempuri" to "com.abc.ws.imageservices"
I would do a trial and error on my free time, but it would take me a couple of days since the job has other priorities..., so I'm hoping that an answer is faster.
You should look into wsimport.
Wsimport will allow you to import directly from a WSDL and one of the parameters in the output project.
wsimport -p com.abc.ws.imageservices -d src/ -wsdllocation http://my.wsdl.com/location?WSDL
If you're using RAD or WID, yes.. it can be done really fast if you refactor the namespace (which would change the WSDL) and then you just have to regen.

CXF Service Assistance

I have a service that was given to me, that basically searches the inventory of a future partner. The file they sent is a compiled .jar file, and a wsdl file. The read me file states that it can be used with XFire or CXF. How do I set this service up using Apache, Tomcat, Spring, or whatever else I need to do? It's a fairly broad question, but I am at a loss as to what to do here.
Your choices are as follows:
Hire a Java programmer, or
Become a Java programmer yourself.
In your shoes, I'd opt for #1. You probably have enough on your plate running your business to learn the ins and outs of coding.
Most likely the jar file you got is actually the generated java beans (jaxb) and stubs (jax ws and the likes). So you should be able to figure our an entry point class there and use that to call the webservice. But as others suggested very little information to really give an answer. JaxWS docs are here http://docs.oracle.com/javaee/5/tutorial/doc/bnayl.html

Categories