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

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...

Related

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

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

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.

What is the advantage of using OData with Web API?

I am already using the standard WebAPI and returning JSON objects to my client. Now I saw an application that returned OData.
Can someone explain if there is any reason for me to use OData if I do not want to query my data from anything other than my own client running in the browser. Are there advantages that I could get through using OData ?
If you are only using your data in your own browser application, there is only few advantages to use OData in your situation:
OData is able to provide metadata about your service interface that can be used to generate client code to access the service. So if you have lots of client classes that you need to create, this could speed up your process. On the other hand, if you can share your classes between the server and an ASP.NET based client or if you only have a few classes, this might not be relevant in your situation.
Another - bigger - advantage in your situation is the support for generic queries against the service data. OData supports IQueryable so that you can decide on the client side on how to filter the data that the service provides. So you do not have to implement various actions or use query parameters to provide filtered data. This also means that if you need a new filter for your client, it is very likely that you do not have to change the server and can just put up the query on the client side. Possible filters include $filter expressions to filter the data, but also operations like $skip and $top that are useful when paging data. For details on OData and queries, see this link.
For a complete overview about OData and Web API see this link.
Here are few advantages of OData.
OData is a open protocol started by Microsoft is based on Rest Services so we can get data base on URL.
It suppport various protocol like http,atom,pub and also support JSON format.
No need to create proxy classes which we used to do it in web service.
You will able to write your own custom methods.
It is very light weight so the interaction between client and server will be fast compared to web service and other technologies.
Very simple to use.
Here are few reference links.
http://sandippatilprogrammer.wordpress.com/2013/12/03/what-is-odata-advantages-and-disadvantages/
http://geekswithblogs.net/venknar/archive/2010/07/08/introduction-odata.aspx
http://www.zdnet.com/blog/microsoft/why-microsofts-open-data-protocol-matters/12700
I agree with the answers already posted, but as an additional insight...
You mentioned that:
... if I do not want to query my data from anything other than my own
client running in the browser...
You may not wish to run it normally through anything but your own cilent, but using oData you could use other querying tools for debugging. For example LinqPad allows you to use oData endpoints (such as that provided by stackoverflow).
It's probably not a good enough reason to implement oData if you don't have another reason to do so, but it's an added bonus.

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.

SOAP, HTTP(S) POST. XML and Schema mess

I am very confused. I have a xsd file, no wsdl and apparently i send this data through SOAP. Now looking at all i went back and notice this
(using ssl) The regular session begins
with a HTTP POST request sent by the
client. The body of the request
contains XML document compliant with
SOME_API Request schema
So... i am not using SOAP at all? Am i suppose to do something with the schema file they provide me? No one here (at work) seems to know.
You should start by reading Http made really easy. Soap uses http to send its messages from client to server, and when the document you are talking about is asking you to send a message to the soap server using the HTTP protocol. A bit of googling should find you some nice soap getting started guides.
The message you send is an XML document that uses this schema. The schema defines the types of XML that are valid. Get a good XML editor such as oxygen and tell it you are making a new xml document using a schema (point to your xsd file) and see what you are allowed to type.
My search turned up these two:
Tutorial point SOAP Tutorial
W3Cschools
Just send an HTTP POST with XML that complies to the schema. You can either read the schema manually (which can be hard), or use an XML editor like Tom is suggesting, but there's another possibility: Many platforms offer tools that automatically generate classes from XSD schema, which you can later automatically serialize to get the correct XML.
For example, if you use .NET: Use the xsd.exe tool to generate classes from schema, then just fill these with information as regular classes, then use the XmlSerializer to convert the root class to XML.
Based on your description, it seems that it's not really a SOAP API at all, but rather something like XML-RPC.
Just send an HTTP POST with XML that complies to the schema. You can either read the schema manually (which can be hard), or use an XML editor like Tom is suggesting, but there's another possibility: Many platforms offer tools that automatically generate classes from XSD schema, which you can later automatically serialize to get the correct XML.
For example, if you use .NET: Use the xsd.exe tool to generate classes from schema, then just fill these with information as regular classes, then use the XmlSerializer to convert the root class to XML.
You are learning why standards should be followed.
If this is really a SOAP-based web service, then there must be a WSDL. There is no exception to that. The WSDL is meant to describe everything you need to know about the web service. I strongly suggest you ask the developers of the web service whether it is a SOAP web service, and ask them to supply a WSDL or to explain why they think they should not do that.

Resources