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.
Related
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.
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.
It seems that most of the new kids on the block are using RESTful web services rather than SOAP. I've only dabbled in them enough to know the basics of how they work.
Essentially in a SOAP implimentation, you are able to use a WSDL file that describes data types as well as usable RPC's. Finding a WSDL file and simply adding it as a service reference in visual studio is awesome and easy to impliment.
In a REST web service you have one (or more, depending on overrides) method for each action you are wanting to take (GET, POST, PUT, DELETE). While I can see how this would be beneficial, I can see problems with this... such as still having to deserialize into a local object.
So my question is... can you actually get intellisense when consuming REST web services? When you add a service reference to a WSDL you are able to see the list of usable methods. Otherwise, is the only way to actually see the usable methods through documentation? Is there any "self-containing" document that describes to VS what you can use and/or how to interpret data types without having to deserialize/serialize.
What is the reason why hitting, for example, http:///_vti_bin/UserGroup.asmx?wsdl gives me a not full wsdl specification (if compared with http://msdn.microsoft.com/en-us/library/dd965659%28v=office.12%29.aspx)?
What I mean about not full: it does not contain some of complex types definition, e.g. User (unlike the full one), so this types are no generated by the wsdl.exe.
I have a question in regard of this: is it safe to generate c# web service stub basing on specification from MSDN or this approach is dangerous due to possible changes in contract?
For your first question as to the WSDL not being the same: it really should be equivalent and contain all the types! Whenever you append /_vti_bin/UserGroup.asmx?wsdl to your site's URL, SharePoint should definitely display the FULL WSDL, including the complex type definitions, etc. I just tried it now against my own SharePoint instance and the WSDL returned from http:// mysite.com/ ...snip... /pierre/_vti_bin/UserGroup.asmx?wsdl is pretty much the same size as the one from http://msdn.microsoft.com/en-us/library/dd965659%28v=office.12%29.aspx and a quick check to make sure complex types are in both places confirm that.
To answer your second question: I think you should NOT create your Web Service stubs and skeletons based on the WSDL in the documentation. Instead use the WSDL returned from your site. If you're not getting all the complex types in the WSDL returned from SharePoint, you should fix that issue first.
First thing I would try: download SOAPui (free) and simply plugin the URL that ends with ?wsdl and create sample requests. Maybe you'll run into access issues (UAG or other) but at least you'll know that the WSDL is well formed. If SOAPui can generate the client code based on the WSDL, you can too (using wsdl2java or the wsdl2dotnet equivalent; I can't remember the name of the .net version).
And yes, it's dangerous to copy the WSDL from the docs but I'd be more worried about some things being abbreviated or documentation going stale, etc.
As for the contract changing, I'm using the UserGroup.asmx?wsdl endpoint since 2009 and it still works on newer versions of SharePoint (even after the upgrade to SP2010). And I'm using java as the client code. Microsoft really nailed the Web Services in SharePoint, it was surprisingly easy to integrate our java stack and make calls to/from the SharePoint web services. And it was also very inter-operable with the other tools we use to test Web Services like SOAPui, etc.
Is there is any possibility (special approach or wsdl2cfc utility) to generate web service (or it’s stub) with complex input output parameters and custom failure messages based on specified WSDL? I’ve read a lot of articles which describe how to consume that type of web services, but I haven’t found any article which describes how to implement them.
you can specify the WSDL a CFC presents with the wsdlfile attribute, so you can certainly present an existing WSDL, if that's what you've got. Getting CF to map things properly when the service is invoked is another matter. I would start by taking the WSDL you have, making a CFC use it and implementing the right method names with no specified arguments and CFDUMPing the arguments structure to see what CF is getting.
You can do quite a lot to present the web service you want by using CFCs with the right names and CFPROPERTY tags in them. You can also specify in a CFARGUMENT that the type="foo[]" and the generated WSDL will expect a list of FOO objects to be passed in.
I've no experience with returning custom errors through a web service, you may have to play with what CFTHROW does from within a web service
I assume you're trying to implement a service that already exists?