How to automate efficiently testing Reactive webflux API steaming endpoints? [duplicate] - asynchronous

We have a requirement where we need to send .avro file as an input request to our API's. Really stuck at this point. If any detail example provided would be more appreciated.

Just use Java interop: https://github.com/intuit/karate#calling-java
You need to write a helper (start with a static method) to convert JSON to Avro and vice versa. I know teams using this for gRPC. Read this thread for tips: https://github.com/intuit/karate/issues/412
Also there is even a "karate-grpc" project: https://github.com/pecker-io/karate-grpc
Also see:
https://twitter.com/KarateDSL/status/1128170638223364097
https://twitter.com/KarateDSL/status/1417023536082812935

Related

I want to do Message transformations in Datapower instead of IIB?

I want to do message transformation in Datapower instead of IIB. earlier we are using xml to Soap conversion in Handler and sending to IIB. But as per current requirement I need to remove handler and do message conversion in Data Power itself. Please help me if you have sample code and any suggestions on this requirement. Also I need to prepare facade for this requirement. Asking me to prepare POC also.
I am gathering information as xml and xslt code need to use for message transformations in DataPower XI52
expected out put would be removal of handler and in place of it need to use datapower.
If you are only doing XML transformation XSLT will work fine. In IIB toolkit you can even use the Data Mapper to produce XSLT. NB! DataPower only supports version 1.0 of XSLT!
Else there's a lot tools to build XSLT, e.g. Altova Mapper.
Another option is to use ITX (IBM Transformation Extender) but that requires either Integration module or B2B Module on your DataPower. And the ITX Design Studio (which is a separate license).
Third option is to use Gatewayscript, which also can handle non-XML data...

Replace XCC calls with Rest Calls in Marklogic

In an application .Net XCC being used to make communication with marklogic module database to execute module, function and adhoc queries etc.
I want to replace the same XCC calls with REST calls so that we can run application in marklogic 9 as .Net XCC has been deprecated in Marklogic 9.
I have tried in built rest api in marklogic. It only allows to execute module exiting in module database.
Is there any online source stuffs available or anything that could help us.
Any help would be appreciated.
Thanks,
ArvindKr
There is /v1/invoke to invoke modules in the modules database attached to the REST app-server you are addressing, but also /v1/eval that allows running ad hoc queries.
HTH!
If you're going to replace XCC.NET with RESTful calls, try out XQRS, it allows you to build services in XQuery in a manner similar to JAX-RS for Java.
I only consider the following for cases such as yours, where compatibility with legacy code is useful or required and where other options are exausted. This is not an elegant approach, but it may be useful in special cases.
The XDBC protocol (which is what XCC uses) is supported natively on the exactly same app servers and ports which the REST API is exposed. You can see this on port 8000 in a default install. The server literally cannot tell a 'REST Application' and an 'XCC Application' apart except by the URI requested in the request (and in some cases additional headers like cookies). REST and XDBC are both HTTP based, and at the HTTP layer are very similar to the extent that they can share the same ports and configurations.
XDBC is 'passed through' the REST processing via the XML Rewriter. XDBC uses /eval and /invoke while REST uses /v1/eval and /vi/invoke. If you look at the default rewriter.xml for port 8000 you can see how the routing is made. While the XDBC protocol is not formally published its not difficult to 'reverse engineer' by looking at the XCC code (public java source) and the rewriter. For example its not difficult to construct URL and payload data to do a basic eval or invoke call. You should be able to replicate existing XCC.NET client behaviour exactly by using the /eval and /invoke endpoints (look for the xdbc attribute set in the rewriter.xml, this causes the request handling to use pure XDBC protocol and behaviour.
Another alternative, if you cannot solve the external variables problem is to write new 'REST Friendly' apis that then xdmp:invoke() on the legacy APIS passing in the appropriate namespaces. An option is to put the legacy code in an entirely seperate modules DB and then replicate the module URIs exactly with the new code. If you don't need to maintain co-existing versions then you modify the old code to remove the namespaces from the parameters or assign local variable aliases.

Is retrofit of any use if I am already using okhttp3, Moshi and Rxjava in my project?

I have done some R&D on above libraries and have used some in my project.I am using Moshi for json parsing, OkHttp3 library for http connections and Rxjava for asynchronous and event based programming in my project. Now when I looked at retrofit, I felt its of no use as I have already used above main components of retrofit myself.
Just want to know the ideas of the people whether I am thinking in right direction or not.
Edit: From my point of view, Retrofit only provides clean interface of http client where one can customize requests,headers etc with annotations.
This is a good choice of libraries from my point of view. The first three are developed by Square and they work very well together. However the main difference is that each library works on a different layer.
OkHttp: transport layer. Deals with http protocol. Performs networking.
Moshi: Json parser. Transforms bytes from OkHttp into a Java objects.
Retrofit: Rest layer. Transforms HTTP logic (status codes), into REST logic.
RxJava: provides tools to create reactive code, instead of imperative code.

ASP.Net How to call an Unknown (Dynamic) WSDL Webservice and parse it's result?

will appreciate any pointers here. This scenario may sound a bit weird:
I am trying to write a program that consume webservices that user define, and that my program do not know in advance.
For example, my program allow users to set/define all the webservices that they have in their network, into my database.
My program will then show a list of all the webservices that users have defined, and with a click, my program will call THAT webservice (with the parameters that use can key in) and then my program will show the result (string).
Problem is that at design time, I have no idea what are the webservices and the parameters and response. So, I need to dynamically create some sort of a stub that can consume these webservices without having to Add-Reference into my project in advance.
Will appreciate any pointers here.
Sounds like you're trying to build your own SOAP_UI here :) (excellent tool for testing purpose on Webservices) , correct ?
I guess you'd want to play with wsdl.exe.

Passing an Arraylist of Java objects to a servlet from Java program

I would like to pass an arrayList of objects to a servlet from a java program.
Can some one please tell me, how this can be done.
Look at this link they describe the process ind detail
http://www2.sys-con.com/ITSG/virtualcd/java/archives/0309/darby/index.html
Please note that if you are going to serialize objects back and forth that the compiled version must be in sync on both the client and the server or you will get errors. I would recommend converting your objects to either XML or JSON and then reading them from that on the server side. That way if you client and server code get out of sync it will still work.
For the client I would recommend Apache's HttpClient (or whatever they have renamed it to)
Have you considered using a web service framework for this instead of coding a naked servlet? The whole business might be about 10 lines of code using, for example, an Apache CXF JAX-RS service and client. If the objects are complex, you might want to use a full SOAP service.

Resources