I've application in JSF 2.0 (on Glassfish 3). Now I have to write a .NET WCF webservice that will be connected to database and will be used by this JSF app to fill DataTables.
DataTable will have pagination, but how to get (form web-service) only that rows, which will be displayed in single page. And will allow action such as sorting, deleting, editing rows etc...
Is there any bulit-in mechanism/library to supported that? I mean in WCF or JSF2 ?
Thanks for help,
You should have a WSDL file (ask the web service owner/maintainer/admin for it). A WSDL file specifies by XML how the webservice is definied. A bit sane IDE like Eclipse can autogenerate a complete Java client application for it via File > New > Other... > Web Services > Web Service Client. You should then end up with an autogenerated web service client project which you just have to add as Deployment Assembly of your JSF project in order to access/use the autogenerated client classes.
You can find here a concrete tutorial which shows how to generate and use it in combination with a plain Java application project (instead of a JSF project).
As to partially retrieving the data, that depends on whether the web service supports that as per the WSDL. You can always issue an enhancement request at the maintainer of the web service so that they will add this to the web service (and then you should get an updated version of the WSDL and then re-generate the Java client application based on it).
Related
I am using Play framework 1.2.5 in my application in Eclipse IDE. I need to access a web service built using IBM JAX-RPC. I have got the wsdl file of the web service which I need to access in my applicatiom.
For normal Java EE applications, I used to paste the WSDL in my workspace, generate the files by right clicking the WSDL file => Generate Client option i.e. generating files with the help of Eclipse IDE.
I am not sure how to access the WSDL using Play framework.
I want to know:
1) Where to paste the WSDL file in my workspace?
2) In Play framework how do generate the client (Not sure even if we need this or not in play framework) and access the service methods?
3) Any additional settings needed for accessing the service methods?
Please let me know about this.
Regards,
The easy way:
Use Play!'s built-in play.libs.WS (Link #2 and #3). You have to create the raw HTTP requests yourself, and parse the XML result from the server yourself. Of course, this can become a complex task, if the web service interface is complex.
Preferably, you will create a JAX-RPC client based on your WSDL, and use it from your Play! application.
I have create one simple web service and I deploy it to the axis2 web application based on this tutorial
After creating my service, I am able to deploy it to the server and I can see the WSDL file by this url: localhost:8084/axis2/services/HelloAxisWorld?wsdl
Now, I want to call this service by an independent java application. I found some pieces of code that makes the invocation, but I am facing problems because I suppose that I don't include the proper libraries in my project.
Does anybody knows an example to call the web service by using axis2?
A simple Google for 'axis2 client tutorial' gives me this. It covers setting up your classpath properly, generating java from the WSDL via wsdl2java, and developing the client from this.
I've a CXF web service Java classes, I use Eclipse 3.5. I generated the service WSDL file, and it has the <wsdl:types>, but the client that I work for is asking for a separate XSD file, how can I generate it in Eclipse?
If you are using the JavaEE Eclipse (or added all relevant modules to another Eclipse version), right click the class containing your service implementation -> Web Services -> Create Web Service.
Everything should be okay with the default values, just make sure that the first page has the right service implementation class and the page Apache CXF Web Service Java2WS Configuration has the checkboxes Generate WSDL and Generate sparate XSD checked.
I want to generate WSDL compliant with Java classes. At this phase I don't want to put it online, just have the wsdl (in order to discuss it with someone else) and validate the generated file.
I'm using Eclipse, so I would prefer any solution that's already integrated with it.
From eclipse in the java perspective:
Right click on the Java class you want to use as your service implementation
Select Web Services -> Create Web Service
Web service type should be "Botton up Java bean Web Service"
This will generate a WSDL file for you.
Also you can publish the service at localhost with any server (Tomcat, for instance) and then with your browser in the address bar write
http://localhost:<server_port>/path/to/your/service?wsdl
If the service is correctly configured, you should see the generated wsdl. Then you can copy/paste in any text editor and save it as myService.wsdl.
Hope that helps
I have already generated the files using wsdl2Java and created the proxy client in JAVA.I am using Apache CXF framework and using Maven as Build Management tool. I can run the JAVA application and consume the service using JAVA. There is no problem with JAVA implementation.
The need is I need to invoke and request the same web service from PHP or JSP file and display the result in PHP or JSP file. I would like to use the present JAVA code. I don't know how to invoke the JAVA code from PHP or JSP page.
Please help me with the solutions.
You have created a web service, so your design should be centered around that. For Java programs (including JSP's) you can use the generated client classes to access the web service. For PHP I would recommend using one of the many SOAP client libraries to process and consume your WSDL. You might want to take a look at wsdl2php, NuSoap, or SoapClient.