Using spring-ws with already existing WSDL - spring-ws

I am new to spring-ws. what ever tutorial i see starts with xsd and at the end generates a wsdl. What is the approach when we have already an existing wsdl.
Also i was having a doubt on contract first approach which is already discussed (though am not getting convinced with the answer)
spring-ws and contract-first approach
My assignment is to use spring-ws with an existing wsdl. can you please provide me an approach for this.
As per my understanding. In the process of contract first approach, I got the contract already so how to proceed further is not shown in any tutorial.

When developing a web service using Java you can use one of two approaches:
Contract-first: start with an WSDL that defines the web service operations and their input/output messages. Then generate the corresponding Java objects to implement the service.
Contract last: Start with the implementation of one or more methods in Java and generate the WSDL files based on these methods and the Java objects that they use.
Spring-WS, as you already mentioned, only supports the contract first approach. This means that you cannot develop a web service using Spring-WS without first having a WSDL or XSD that describes the input/output messages.
You should be able to create a service using Spring-WS using any valid WSDL file. For a concrete example let me point you to a blog post that I created that illustrates how you can develop a web service using Spring-WS starting from a WSDL file.

Actually spring does support both static and dynamic wsdl. But each comes with different challenges. As from what i have seen, spring works on a notion of pattern matching when comes to generating a wsdl dynamically from a xsd. Like "Request" string which says input and "Response" means output. Now here is a problem where the spring generates a wsdl with synchronous responses. If our requirement is to have asynchronous response then the dynamic wsdl wont work.
To overcome this, we can use the static wsdl and let spring know not to generate wsdl dynamically.

Related

Workday - How to programmatically get list of WSDLs in Workday

I am working on developing an integration with Workday. Under my initial analysis, I found that Workday provides multiple wsdls for different modules like "Human resource", "Inventory" etc. I can see this complete list at https://community.workday.com/sites/default/files/file-hosting/productionapi/operations/index.html
I am trying to understand how I get get this list progamatically in my integration so that my user can select one of the wsdls rather than typing in the full name of WSDL. Please share your thoughts on this.
You can programatically retrieve a list of all web service operations by creating a Custom Report based on the "Public Web Services" data source. The report can then be exposed as a RESTful WS for easy retrieval.
Some fields you can include in the report are: Web service, supported operations, api version, endpoint url, WSDL url, etc, etc.
This is highly customisable, in the sense that you can query the RESTful WS Report for specific versions, specific operations, etc, via Prompts / URL Params.
The report-as-a-service, supports also a variety of output formats as well as its own WSDL.
The purpose of a SOAP WSDL is to generate a client stub, i.e. a model that lets your client interact with objects exposed or consumed by the service provider. You don't interact with a WSDL at runtime - you interact with the stub. If you want to make multiple services available, you have to include each WSDL in your client application at compile time and generate their stubs. The services in a given API version do not change, so there isn't a reason to do this dynamically.
To add to the query asked, what we are trying to understand is that whether there an API call/request which we could hit to get the list of web services available to populate it on the UI to select from it.
For Example: In this link, https://community.workday.com/sites/default/files/file-hosting/productionapi/index.html, we have Absence_Management, Academic_Advising, Academic_Foundation and so on and Now, if I want it to be displayed to the end user so that He can select the webservice to be used and accordingly we could download the WSDL as to work on it.

What is Swagger, Swashbuckle and Swashbuckle UI

This is my understanding:
Swagger is a notation/rules to write documentation. But why is it called a framework (like Angular/MVC)?
Swashbuckle is a program (JavaScript?) that generates the documentation (based on Swagger rules).
Swagger UI displays the documentation. It uses Swashbuckle to do this.
Is this information correct? If not can someone explain in simple terms what Swagger, Swashbuckle, and Swashbuckle UI mean?
Also, what do I lose as an API developer if I do not use this?
Swagger is a notation/rules to write documentation. But why is it called a framework(Like angular/MVC)?
It is probably called a "framework" because its' purpose is to offer a systematic way of notating the interface of any RESTful service under the OpenAPI Specification. This is a big deal to developers because the spec is overseen by the Open API Initiative under the reputable Linux Foundation.
Swashbuckle is a program(javascript ?) that generates the documentation(based on Swagger rules)
Swashbuckle is more of a package (or a library) that you can make use of in your .NET Web API projects. It's purpose, as you have correctly indicated, is to generate the Swagger spec for your project. Additionally, the Swagger UI is contained within Swashbuckle so if you are developing an API in .NET it's really a nice one-stop shop of a package. It is almost entirely written in C#, not JavaScript.
Swagger UI displays the documentation. It uses Swashbuckle to do this.
Yes, it does display the Swagger spec in a nice, human-friendly manner. However, Swashbuckle is not a necessary component for this. They are, aside from what I just said previously, completely mutually-exclusive.
Also what do I lose as an API developer, if I do not use this.
This is now entering into the realm of opinion but I'll try to be objective about it. I use Swashbuckle to assist in the creation of clients for my application APIs. After getting past the implementation learning curve (which wasn't much), this package has saved me quite a bit of time of writing the clients myself. Writing a web client is a trivial thing for small applications but enterprise-level applications have a tendency to keep growing and/or changing in complexity so it is nice to have the creation/updating of these clients completely automated.
In short, if you decide not to use it you must either resort on an alternative method of API client generation or write/update the clients yourself. If you are only developing the back end this may be completely pointless to you but it would certainly help whoever is responsible for creating the client apps that will consume your API services.
I hope these answers have been helpful. Cheers!

Call Rails API in Oracle BPEL

I'm trying to integrate a simple Rails app with a BPEL process but it's been hard since BPEL has few or maybe none support for RESTfull web services.
I've tried already using a HTTP binding but i'm not sure if I got what I want since the component moved to the internal side, and it's actually an external service.
So I have two questions:
I needed to write the xsd file to define the request and response xml structure. I searched and it seems there is no gem for doing this automatically. Is there any? Or even better, is there a gem that creates something like a wsdl file? I know this is for SOAP web services and in RESTful there is no such thing, but creating this files by hand is a pain in the ass. So I search something similar.
HTTP binding is the only way I found to call a RESTfull web service. Is there anything better? Has anyone been successful using it? Or code it in Java and use the Java adapter or something would be easier?
Any suggestion, even if not directly for my questions are appreciated. Thanks.
Also if there are some articles about it, links are welcome.
WashOut is a new SOAP server library and definitely worth checking out.

Groovy/Grails mock web service based on WSDL

I've inherited a Grails app which makes calls out to a web service, using javax.xml.ws* classes and I'm trying to find a way to mock the web service based on the WSDL for the integration tests. I realize that I can use one of the java soap implementations to build this, but I'd rather stay in groovy.
So my question is, is there an idiomatic groovy way to build a web service based on a WSDL?
One approach that is pretty straightforward is to use Jetty to create a mock. It´s easy to create a mock that looks at the request and generates a response, especially if you´re using Groovy. For instance, create a template response file and use the XmlSlurper to fill in values. Then you can either start the mock in your tests or run it independently.
I found the following blog that roughly explains the basic concept:
http://olafsblog.sysbsb.de/lightweight-testing-of-webservice-http-clients-with-junit-and-jetty/

Consuming an ADO.NET Data Service from a WIN32 Delphi application. How?

Simple. I created a LINQ-TO-SQL Entity model, created a website, added a Data Service (*.svc) to this site and made sure it works by writing a simple .NET console application. The service works fine and cannot be modified.
Now I'm going to write a Delphi application (2007) for WIN32 which will have to call this data service. And while Delphi has no major problems importing a SOAP service, it can't import this service since it provides no WSDL...
So, two options. I could figure out how to generate a WSDL based on this data service or I'll have to find another way to consume this service. (Or just give up, but I hate to quit this challenge.) So, any advise?
ADO.NET Data Services are REST services. They are not SOAP WebServices and I don't think REST uses WSDL. You can call REST services from Delphi using HTTP GET/PUT/POST/DELETE. You could use Indy's TIdHTTPClient. See http://msdn.microsoft.com/en-us/library/cc668786.aspx for url examples. The results are in the Atom format, which is a XML format. You could parse it with TXMLDocument. They can also return JSON.
Maybe you can use the project Jedi "url grabber" components to consume the service. I have managed to get live share data using these in the past. I do not know exactly how your setup works, but maybe these can be helpful.
http://www.delphi-jedi.org/
You should also look at synapse, a small easy to use library which works well with REST. The latest version, which can be downloaded via SVN, works well in Delphi 2009.

Resources