How to print wsdl file data using jsp - web-services

In my project we have one webservice which contain the data like date, time, total number of transaction and all this information i have to print in some other website i am using JSP for printing this information but i don't have idea about how to take data and print the information from webservice because i am new in this technology please help me.
this is my data
<asa-details asa-id="1"><dep_txn>6</dep_txn><pre_auth_txn>3936164</pre_auth_txn><pre_bfd_txn>34</pre_bfd_txn><pre_otp_txn>93</pre_otp_txn><prod_auth_txn>505949</prod_auth_txn><prod_bfd_txn>0</prod_bfd_txn><prod_otp_txn>0</prod_otp_txn></asa-details>
Thank you in advance

First of all, check the wsimport program in your jdk installation. This lets you convert a wsdl file to java classes. (Or use the wsdl2java which comes with cxf)
Next I suggest taking a look at the cxf framework for communicating with the web-service itself: http://cxf.apache.org/
They have really good guides and the framework is well supported.
This framwework will hide all complexity of working with soap envelopes for you. You are just working with java classes.

Related

Does the existence of a .wsdl file mean files must be generated?

When I'm tasked with dealing with connecting to web services, I've always found the appropriate .wsdl file, ran WSDL2Java.bat, and incorporated those Java files into my Java project. Then I've successfully completed my project that needs to access data via web services.
My question is, are there other ways to use the .wsdl file to access web services? ( I'm not talking about creating classes for different languages ). For example, I have documentation describing one company's web services. The examples it shows in it's documentation are essentially dumps of HTTP Post requests. Is this "web services"? It looks to me that the .wsdl file is merely used as a reference to make the correct Post requests. I could just make text templates and plug in the right values, and send them out, right? I really feel like I'm missing something here.
Am I a web-services illiterati?
To call a SOAP web service over HTTP you just need to send it a properly formatted XML with a POST request. That's it! How you build the request is irrelevant as long as it conforms to the SOAP protocol and the payload corresponds to a proper web service operation that exists on the particular web service you are calling.
But how do you know how to build the proper payload?
The web service needs to have some sort of documentation otherwise you don't know what to put inside the XML. The documentation can be whatever you like as long as people can use it to build valid requests. WSDL fits this criteria but has an extra advantage: you can feed it to a tool that generates code. That code knows how to handle all the SOAP details and exposes objects and methods to your application.
What would you prefer? Generating code from the WSDL in a few minutes and be able to call whatever operation on the web service or, build the requests and parse the responses by hand and spend hours or days doing so. What would your boss or company prefer? :)
It looks to me that the .wsdl file is merely used as a reference to make the correct Post requests. I could just make text templates and plug in the right values, and send them out, right?
Right! But you also have to consider your productivity as an employee in one case as opposed to the other.

RESTful Web Service In Grails

I made an OCR service using Grails and everything is working very well. I want to make a Web Service for it. The input of the RESTfull WS should be in mime format (the client will send some images and related information in XML format to this WS). How could I implement this in Grails? Any Sample codes to guide me?
Thanks,
Reza
These days, most people do by writing one or more controllers that accept and return text/json (or text/xml if you really want).
Grails has great libraries on board for parsing these requests, all of which are part of the Groovy language:
JsonSlurper
XmlSlurper
JsonBuilder
MarkupBuilder (for making xml)
I have used the approach above successfully on a project. You will end up with Controllers that are easy to unit test, which is a huge productivity win.

calling web services from UNIX

I have a requirement to kickoff a workflow which is in salesforce.com thorugh web service from UNIX box. Can any one suggest me options or guide lines to achive this scenario?
I don't think you can just "kick off workflows". You'll have to perform an insert or update of records in Salesforce that will satisfy the workflow's entry criteria.
There's a Java tool called Data Loader for your basic data manipulation activities (you can download it from your own production org)
and it can be scripted for scheduled runs, has config file where you can store user's password in secure way etc. Check out the pdf guide for more ("Command Line Quick Start" chapter)
So I don't think you really need a webservice call...
Unless I misunderstood and you're talking about calling an Apex class' method that has "webservice" keyword and it will somehow perform the updates?
In that case you'll need to download the WSDL file generated for this class (Setup->Develop->Classes) and well, consume it in language of your choice (Java, PHP, Python... this link will help, steps aren't too different), then do your command line magic?
http://wiki.developerforce.com/page/Integration has tons of resources for you :)
Salesforce uses SOAP for their web service. They don't have restful web services now. Just request them to give the wsdl file.
Use this wsdl file to generate the java code. After that get their webService url so that you can proceed with your data pulling
This link may help you..
http://salesforce-walker.blogspot.in/2011/12/to-access-salesforce-data-from-java-we.html
Hope this helps

Generate WSDL for existing SOAP Service using captured traffic

I need to use the SOAP service of a printer. There is a windows tool to access this service and I used it to generate SOAP requests and responses of the important functions that I need.
Now I should write a client for Linux using Python and I found the easiest way would be to use the suds library with an WSDL file. But I don't have this WSDL!
As I investigated the windows tool (looked at the hexdump of the executables), I came to the conclusion that there probably is no WSDL file at all.
Now my question is, has anybody experience with "reverse engineering" SOAP services and knows tools which could be useful for creating WSDL files for existing services? (Googleing hasn't brought up anything useful yet).
You mentioned this is the SOAP service of a printer. Is the printer's API documented on the manufacturer's site? Does the documentation include the WSDL? Can you get the WSDL from the manufacturer?
If you can get the WSDL from the manufacturer then you're done!
If not, then you have to build the WSDL by yourself because I doubt you can find a tool that generates WSDLs given SOAP samples (when working with SOAP web services you mainly get two kinds of tools: those that generate code from WSDL + those that generate WSDL from code).
It's not hard to create the WSDL if you are familiar with SOAP, WSDL and XSD. You just need a text editor or maybe even a WSDL editor to speed things up.
If you don't have full confidence in your WSDL knowledge, there are still some tools that can get you most of the way to the complete WSDL. Here is a way you could do it:
1 - First you need to create the XML schema for the SOAP payloads. For this you can find tools, even some online. After you have the schema, tweak it to your needs by adding, changing or removing elements.
2 - Now you can use the XSD to generate a WSDL. There is an online tool that does that. It just needs the request/response element types to end with Request/Response. Make sure you read the instructions.
You take your XSD file, change the names of the operations to add the Request/Response suffix and feed it to the WSDL Generator - Web Tool. You will get your WSDL.
Now tweak this WSDL as you like (remove the Request/Response suffixes if you don't need them) then ...
3 - ... make sure you end up with a valid WSDL.
4 - Now you can take your WSDL and use a tool like SoapUI to generate sample requests and responses from it just to verify that you get the proper results back.
Do the SoapUI messages match the messages you started with? If yes, you are done and can feed the WSDL to suds to create the Linux client. If not, tweak the WSDL until you get the result you are after.

ColdFusion Webservice Parameter Structures

We are trying to consume web services with ColdFusion.
I am able to interact with the web service for the most part, however, there is one service where ColdFusion is throwing a "Parameters Could Not Be Found" error because the response message in the WSDL for this particular service is a blank parent class. I need to add the specific parameters of corresponding subclass that inherits the class pointed to in the service of the WSDL.
Is there a way to tell ColdFusion to use a certain class definition for the parameters?
Or, is there a ColdFusion tool for showing the acceptable parameter formats for a given WSDL?
EDIT
Or, is there a way to hook into the ColdFusion code that does the parsing/conversion of the parameter structure from the WSDL?
My guess is that even finding a third-party tool will not help much because I need to know what ColdFusion is going to do, not what the data SHOULD be; I know what it should be.
You can use your own WSDL file, you don't have to use the one generated by ColdFusion, just generate one, customize it and point people to your custom WSDL file instead of the YourComponent.cfc?WSDL url.
This article on consuming complex web services may help:
http://tjordahl.blogspot.com/2008/04/reprint-consuming-web-service-complex.html
Also note that if you have a copy of Dreamweaver laying around, it has a tool for inspecting WSDL and generating the required ColdFusion code.
Or, is there a ColdFusion tool for showing the acceptable parameter formats for a given wsdl?
Please see this SO question and answer
Maybe my code samples can help you.