This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Beginner on Webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Beginner on Webservice" Watch "Beginner on Webservice" New topic
Author

Beginner on Webservice

Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
Good Day,

I want to create a webservice using Java.

I already have the URL link of WSDL and the endpoint. In that Wsdl i want to use operation which called SalesInsert and SalesRetrieve.

How can I do that in Java?

Regards,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
All major SOAP stacks come with tools that can create Java client-side code from a WSDL. Which SOAP stack do you intend to use for the client?


Ping & DNS - my free Android networking tools app
Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
Hi, Im not sure what to use.

We have a Java project. The function is, there are two text box in a JSP page then a submit button.

When i click submit, it must call the WSDL operation SalesRetrieve to retrieve the data. And I will parse the response to display in a page.

Have any recommendation?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
So you want to access a SOAP WS from within a web page? I strongly advise to refactor your SOAP WS into a REST WS (or add a REST WS) that returns JSON. You will be so much happier :-)
Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
HI, based on my understanding, the codes should be in a Java backend. Its just the webpage is the trigger.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
Then my advice stands: implement a REST WS for those endpoints you need to access from a browser. You can use a Java library like Jersey for that.
Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
The WEB is already ther, the submit button is calling a controller then a back end Business Class and calling another Layer. How to implement the call on the last layer then just return the data to the controller.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
I'm confused - that sounds like a regular web app. Or are you saying that what you just described uses SOAP from browser to server? If so, I don't understand what it actually is that you're asking, since it seems to be in place already. If not, then I'm not sure how it is relevant to this problem.
Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
I have the following:

http://oursite.com:3333/Sales.wsdl

in that wsdl there is a operation called SalesRetrieve.

Actually, I always run it via soapUI. Its just as we want to implement it in Java. Maybe a page where there is a submit button, then it will send a request to that endpoint. but they want the calling on backend.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
Its just as we want to implement it in Java.

So you want a Java client, not a browser client? If so, what is the "page" in:
Maybe a page where there is a submit button
Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
For browser, it will just have 2 textbox for the parameter and a submit button. submit button will call function in server side that will send a request based on that wsdl. Then it will parse the response then it will send the data in the browser for output display.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
OK, finally the full picture emerges. The browser accesses via standard web app means a Java web app, which in turn calls a WS, processes the results, and sends back a page to the browser. In that case, what I said in my first post applies - use the tools that come with whatever SOAP stack you intend to use to create Java client code. That Java code you would then build into the web app, and it would use the two parameters you mentioned when accessing the WS.
Hisouka Devera
Greenhorn

Joined: Oct 16, 2012
Posts: 28
Very Thanks. What is the best tool or easiest tool to use?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
You should use the code generation tool that comes with whatever SOAP stack you intend to use, as I have said several times by now.
Anindya Roy
Ranch Hand

Joined: May 11, 2014
Posts: 67
You can look at how to create jax-ws webservice - http://www.sblog.in/2014-03-08-02-31-08/soap/22-jax-ws-webservice-in-eclipse-tomcat

You can look at how to consume jax-ws webservice - http://www.sblog.in/2014-03-08-02-31-08/soap/23-consume-jax-ws-webservice-in-eclipse


http://www.webtuts.in
Sujeeth Pakala
Ranch Hand

Joined: Mar 24, 2009
Posts: 94
If you have JDK6 installed and PATH is set, just run wsimport <wsdlfile url>. You will get required artifacts to consume/develop web service.


Regards, Sujeeth Pakala
SCJP, SCWCD, SCBCD, ICAD, XML Master Basic, Certified SOA Professional
Asif Ameer
Greenhorn

Joined: May 28, 2014
Posts: 1
Check the following Video Buddy,

I did it with this video help

http://www.youtube.com/watch?v=zn8vLBOEhic
Chaitanya Donepudi
Greenhorn

Joined: Dec 23, 2013
Posts: 1
If you have WSDL with you, you just need to generate Stubs and Skeletons based on the SOAP stack you are using (JAX WS/Apache CXF/AXIS etcetera). That can be done using the IDE you are using or using Maven wsimport statement. Once you have the stubs and skeletons, you just need to create a new Service class Instance in your java code and get the Port(endpoint) from it. Now call which ever operation you want to and use the data that you get. Hope this helped!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Beginner on Webservice
 
Similar Threads
Axis 2 WebSevice - Testing
Calling a .net web service from java as a client
SELECTION MUST BE WSDL while creating SOAP WEBSERVICE in eclipse
Simple Web Services application ?
multiple wsdl file