I have some web service (CXF) on Mule Esb (3.4). At the current moment I try to find the simple way to set up web service response that I need for UAT. I read a lot of information in the internet and as I understood there is a special framework Munit for all types of testing. But, it seems, this framework is used for more complex things than I need. So, could anybody recommend me a simple way to force Mule Esb return predefined xml response. It will be fine if I create an xml response as xml document, upload it in any folder and Mule will send it as response when I call a web service. Thank you for any info for solving my task.
You could probably upload the example responses to the classpath and then, in your flows just load that file and set it as payload.
See this other stackoverflow question around how to accomplish this.
You could use 2 flows.
1 flow for production with the Webservice implementation and 1 flow for UAT testing which returns you just a predefined XML (for example via the http endpoint).
Put both files in a seperate file and make a mule-deploy.properties file for both UAT and Production where you include the corect flows respectivly.
Related
I am absolutly new in the WSO2 world and I have the following problem.
I have to developer a toolkit application and the customer says to me that, if possible, they want introduce WSO2 technologies in this project. I will try to explain what exactly this toolkit project have to do to try to understand if and what WSO2 technologies eventually can match with the requirement.
The toolkint project have to do:
1) When executed have to connect to a local database and perform some queries.
2) Use the data obtained from the previous query to create an XML document.
3) Send this XML document into a request to a web service (I think that the content of this XML will be put into the request body of the sended request).
4) Use the web service response to update some data in the local database.
So I am trying to understand if there are some WSO2 technologies that match these requirements or if it is better to create this toolkit as a simple standard Java program.
Searching online I have identified WSO2 Enterprise Integration and WSO2 Data Services Server (that I think it is included into WSO2 Enterprise Integration).
At the beginning I had thought to use Data Services Server to access to the DB, perform the queries and so retrieve data from the DB tables.
But reading the official documentation (https://docs.wso2.com/display/DSS351/About+Data+Services+Server) it seems to me that it is more a technology thinked to expose a DB using web service, infact in this documentation I can read:
Data services provide a convenient mechanism to configure a Web
service interface for data in various datasources such as relational
databases, CSV files, Microsoft Excel sheets, Google spreadsheets
etc...
Infact reading this official tutorial: https://docs.wso2.com/display/DSS351/Quick+Start+Guide
it seems to me that if does the opposite of what I have to do.
IT DOES:
SET THE DB CONNECTION.
PERFORM THE QUERY.
EXPOSE THE DATA RETURNED BY THIS QUERY AS A WEB SERVICE.
I HAVE TO DO:
SET THE DB CONNECTION.
PERFORM THE QUERY.
SEND THE OBTAINED DATA TO A WEB SERVICE (in XML format).
So it seems to me that Data Services Server is not the right choice because it seems to me that more than help me to do data access, data manipulation and send these data to an endpoing it is useful to do data access and to expose these data as a web service (but maybe I am missing something).
So I am trying to understand if WSO2 Enterprise Integration contains some modules that better fulfills my requirements.
Reading the official documentation (https://docs.wso2.com/display/EI600/Enterprise+Integration+Patterns) it seems to me that I can use:
1) BPEL/BPMN process to define the operations flow.
2) It seems to me that I can do DB queries but I always have the same doubt (that it is used to expose the retrieved data as service and not to use internally, it seems to me that this is WSO2 Data Services Server putted into WSO2 Enterprise Integration).
3) I think that this module provides me a way to aggragate data from some queries into an XML document: https://docs.wso2.com/display/EI600/Transforming+Message+Content
4) I can send a request with the previous generated XML usingsomething like this: https://docs.wso2.com/display/EI600/Sending+a+Simple+Message
So can you help me to identify what WSO2 techonlogies I can use to implement something like this or if it is better to implement it manually in pure Java?
1) When executed have to connect to a local database and perform some queries.
R:/For this point you can create a data service using DSS or EI.
2) Use the data obtained from the previous query to create an XML document.
R:/You can create a proxy service using the ESB or EI, inside the proxy service you call the data service created in the previous point(using call mediator) and get the response message in a property mediator to create a new payload message(using payload, enrich or/and a xslt mediator).
3) Send this XML document into a request to a web service (I think that the content of this XML will be put into the request body of the sended request).
R:/Inside the proxy service created in the previous point and after the creation of the new payload message you can send that payload to another webservice using call mediator.
4) Use the web service response to update some data in the local database.
R:/ You can get the response message, create a new payload message and call another data service, or another operation of the same data service created in the first point.
UPDATE 1:
you can use the IDE or the web UI, as you like. for the implementation check this out: Combine two queries using WSO2 ESB as a start.
Inside the IDE you can go to Developer Studio menu, clic in OpenDashboard and create a "ESB Solution Project" or a "ESB Config Project" for the ESB stuff, and a Data Service Project for the data service.
We are designing a Java middleware web application, something like a ESB, such as IBM message broker or mule.
We have many Oracle EBS interfaces(soap web services), and now the salesforce CRM wants to call the EBS interfaces through the middleware application.
Slaesforce CRM calls the middleware by rest json, and the middleware calls EBS by SOAP webservice. The picture below helps you know my meanings.
We have struggled many days to design the middleware with Spring Integration. But we found it difficult to do this. We still need to generate a jar file(by CXF) for every EBS interface(each wsdl with a jar file), and call the EBS interface by the traditional web service way.
We do not want to generate the webservice client jar files for each EBS interface. Is spring integration suitable for this(no generating the jar files for each WSDL, just some configuration or not much coding)? If not, can you suggest some other product else?
Thank you very much in advance.
For the SOAP interaction Spring Integration provides the WS module which is fully based on the Spring WS project.
I don't see reason to generate something, if you just can use the Spring Integration's <int-ws:outbound-gateway> to call that Oracle ESB service.
For this purpose you just need to know which XML to build for the request and which to parse from the response.
Seems for me for this purpose it would be enough for you to know the service WSDL and investigate it from the SOAP UI.
If I were you I'd just forget the CXF when we are with Spring :-).
An API gateway is one product which can be used here. Typically, it acts as a proxy between the client and the applications, but it can also do transformation between JSON and XML, which is what would happen in a REST to SOAP conversion.
MuleESB, although not a gateway can also be used for this purpose, see this link How to convert SOAP web service to REST web service in Mule
We did this by ourselves.
We developed the middleware by ourselves with Java.
We used java with freemarker template to convert the json request to required soap envelope body. Then used apache httpclient to call the web service(oracle EBS).
I am doing a POC for a tool called informatica functionality if that can be used to read the data from a webservice which publish data. It will be like there is a external data provided which is ready to publish data over webservice and I have to use the adapter of this toll to read that data and create a flat flile out of it. There will be no input provided from our side(other than autentication.). Are there any such web services available which can be sued for that /
You can look an UDDI of some available web services you can use, and also few companies has web services for test purpose like Publicly Available Web Services
In my experience, reading webservice data is fragile using Informatica and it depends on the type of Webservice how well it works.
Testing works best, if you have at least some wsdl file, that you can feed into SoapUI. With the pro-Version you can even use that wsdl File to provide a dummy Webservice which you can then read data using Informatica.
Here are some webservices you can try: http://www.w3schools.com/webservices/ws_use.asp
Situation:
We are planning to build a set of new services a long side a set of old SOAP (Spring, apache CXF) web services. Our customers are used to being able to use ?wsdl to get a wsdl describing a service and the content it will accept/return.
I'm looking at providing the new services via spring controllers and RESTful urls. However not all of a request can be handled via a RESTful url, so we still need to have a payload request and responses. I'm looking at use #RequestBody and #ResponseBody and spring's Message Converters to auto(magically) handle both XML and JSON content. The idea being to let spring do as much of the heaving lifting as possible.
The problem:
I'm trying to figure out if it's possible given the REST/Message converter concept, to be able to provide a description of a service and it's request/response data in a similar fashion to the ?wsdl request. I understand that there are WADL documents that can be generated by some systems, but they appear to be a proposel and not fully accepted yet.
Does anyone know if spring can generate WADLs or something else that I can use to allow clients to query the RESTful services data structures?
SpringMVC doesn't support WADL auto generation, mostly because it doesn't use the JSR-311 standard REST API.
I have create a blog entry with a simple WADL generation Controller in java :
Tuxgalaxy Blog Entry.
But Tomasz Nurkiewicz also provide a WADL generation Controller in scala :
nurkiewicz Blog Entry.
You could use CXF JAX-RS for your REST services since you're already using it for SOAP (you can even expose the same service as SOAP and REST with CXF), and CXF gives you the WADL that you want by adding ?_wadl&_type=xml
The following code will work with Spring REST 4x and its based on the suggested code by tuxgalaxy provided on below https://jira.spring.io/browse/SPR-8705
http://javattitude.com/2014/05/26/wadl-generator-for-spring-rest/
When I want to find a "Big" Web service (WS-*/WSDL based) of required functionality I can simply google for ".... filetype:wsdl" because Google indexes also WSDL definitions. Or I can simply use some registries that already crawled the Web for WSDL definitions for me, e.g. SeekDa.com or ServiceFinder.
When I want to find RESTful Web service (RESTful Web API) I may count only on the community, because it is not possible to distinguish between URI of RESTful Web service and other Web resources (e.g. Web sites URLs) and hence any focused crawler cannot tell for 100% sure: this is URI of RESTful Web service. So, I come e.g. to the ProgrammableWeb.com and I hope someone already used/found the service I'm looking for and registered it there.
Recently, I was looking for the Web service for abbreviation expansion. I couldn't find it in portals like ProgrammableWeb, because no-one has put it there. Finally I was forced to browse through several abbreviation dictionaries sites, dig and drill there and I finally found Abbreviations.com Web service API in RESTful form. That took me a lot of time!
Is there any other Way to discover RESTful Web services on the Web?
There is a convention (recommended in REST API Design Handbook for example) that you expose a /api endpoint at the root of your service. This returns an XML or JSON response containing the "child" resources that your service supports e.g. /api/products
The REST ideal is that services are as consumable as Web Pages are, they don't need registries. [Got to admit I don't fully "get" the implications of this RESTful world, no WSDL, no registry feels like riding a bike with no stabilisers.]
In the old Web, pre-Google, how did we find pages? Effectively word-of-mouth and a few key starting points. REST services so far as I can see are pretty much in the pre-Google stage.
I don't agree that "it is not possible to distinguish between URI of RESTful Web service and other Web resources" - if we follow the link we get certain types of content application/xml and application/json would be pretty strong indicators wouldn't they?
There's a WSDL-like file for REST webservices: it's called WADL.
SoapUI now can discover the REST services. It works as a proxy, writing down all requests/responses that pass through. Having requests and responses SoapUI recreates descriptions/definitions of the services.
Now the definitions can be stored in WADL and WSDL formats (as WSDL and XML-Schema in XML world). It also can be stored in Swagger format. I prefer Swagger.
Swagger can be stored in SwaggerHub right from SoapUI, which is like GitHub for source code. SwaggerHub is one of many API management systems.