Extract subset of methods from WSDL - c++

I'm integrating with a web service providing a huge WSDL file containing lots of methods. Of those methods, I only need a few (up to 10) plus (obviously) corresponding types used in them. Is there a way (except manually editing the WSDL file) to extract only a subset of methods and create new WSDL file for the very same web service? Maybe there is a tool or a script of some kind in existance? I failed finding one myself.
The reason I'm asking is that I'm using gSOAP-provided wsdl2h and soapcpp2 utilities to convert aforementioned WSDL file into C++ wrapper, and then compile it into static library. The size of the library then comes out around 300-500 MB depending on compiler and type of build (debug or release), that is if I even succeed compiling it, which obviously is too much for a simple integration I'm implementing, and sometimes even too much for compiler to then link the library with an executable.
gSOAP-specific solutions are acceptable.

That is one huge WSDL. I would suggest that you get yourself a copy of either Liquid XML designer or Altova XML spy. These tools will make editing the WSDL much easier. I don't know of any scripts that will automate this for you.
It would be a simple matter of visually deleting the operations you don't need in the WSDL if you use either one of the two tools mentioned above.
I have used both these tools for editing WSDL's and they make the job trivial.

Related

create a project from a template

I have several project setups in very different languages. For example an android project.
Whenever I want to create a new android project I copy that project, rename everything I need to rename and I have a ready to go project with which I start working.
Since this is very time consuming and I am sure this can be automated I thought about creating a tool that does this for me, but then I thought there are probably thousand solutions out there, which solve the exact same problem already, I am just not aware of.
So my question is, do you know of any tools like this? The requirements I see are, that it has to be os, language, IDE independent and it must support a command line interface. Ideally with less setup effort.
You should try Telosys (https://www.telosys.org) a lightweight code generator that is able to generate any kind of langage with any kind of framework.
This tool is quite simple, free and Open Source.
It provides a Command Line Interface (so it can be used with any environment/IDE).
It is usualy used to boostrap a project and to generated all the repetitive code (CRUD, Controllers, unit tests, HTML pages, etc)
See also :
https://modeling-languages.com/telosys-tools-the-concept-of-lightweight-model-for-code-generation/
https://www.slideshare.net/lguerin/telosys-project-booster-paris-open-source-summit-2019

Node.JS/C++/Python - edit Excel .xlsx file

I'm looking for a way of editing and save a specified cell in Excel 2010 .xlsx file from Node.JS. I realize, that maybe there are no production-ready solutions for NodeJS at this time. However, NodeJS supports C++ libraries, so could you suggest me any suitable lib compatible with Node?
Also, I had an idea to process this task via Python (xlrd, xlwt) and call it with NodeJS. What do you think of this? Are there any more efficient methods to edit XLSX from NodeJS? Thanks.
Basically you have 2 possibilities:
node.js does not support C++ libraries but it is possible to write bindings for node.js that interact with a C/C++ library. So you need to get your feet wet on writing a C++ addon for the V8 (the JavaScript engine behind node.js)
find a command line program which does what you want to do. (It does not need to be Python.) You could call this from your JavaScript code by using a child-process.
First option is more work, but would be result in faster executing time (when done right). Second possibility is easier to realise.
P.S.: To many question for one question. I've no idea about the xls-whatever stuff, besides it's "actually" only XML.

XSLT dependencies across OSGI Bundles

I have been researching OSGI to determine its viability for updating an existing project. The project currently consists of modules (which are basically just directories) that contain XSL Transforms. The transforms contain dependencies on transforms from other modules in the form of xsl:import and xsl:include statements. The reason I am considering OSGI is because as the number of modules increase, it is becoming more difficult to keep track of the dependencies and effectively test the modules.
Is it possible using the OSGI framework to declare XML/XSLT resources contained in a bundle and reference these resources in the import statements of XSL Transforms in a separate bundle.
Yes, this works as Lukasz indicated, you need to write a simple URIResolver based on the extender model. An interesting approach is to use the Provide-Capability and Require-Capability headers to model the dependencies. This will allow you to handle the dependencies with good diagnostics, allows you run multiple versions side-by-side, and it will work with OBR, a resolver that can find the missing parts. See http://www.osgi.org/blog/2012/03/requirements-and-capabilities.html
And this would be the first time I see use of the fact that XSLT is XML ... you could write a simple style sheet that generated the Require-Capability headers! :-)
Your question seems very interesting. Personally, I am working on a system that has two bundles. One bundle contains XSLT Processor implementation (we are using Saxon) while the second one contains multiple XSLT files (which make usage of xsl:import instruction). And it works cool in OSGi environment (Fuse ESB actually) however we needed to implement javax.xml.transform.URIResolver interface and pass it to converter.
I suppose you would need to use the similar approach. Hope this helps.
I would just use Maven for dependency management if I were you - it's simpler to set up your dependencies and it handles transitive dependencies very well indeed. Use OSGi if you need to be able to change the XSL modules at run-time. In both cases you'll need to implement the URIResolver mentioned in the other answer.

web services api: to wrap or not to wrap?

When providing a web services API (well, let's say SOAP), do you provide a library wrapper along with it to make it "easier" for people to use? Or do you just package up a WSDL and documentation for it and let people figure out what to do with it?
What are people doing usually? I've seen a bunch of examples where the wrapper is provided, but it has always seemed counter-productive to me.
WSDL is easily discoverable (all functions & types as declared), so there is usually no need to offer any package with it, and minimal documentation (apply an XSL to the WDSL and it's usually enough :) ). My theory about the appearance of libraries/wrappers is that it is directly related to security measures / needed authentication & hashes (usually: concatenating some fields with a secret & hash it), about which one simply doesn't want to answer every single question anymore.
Audience matters I think: if you want you run-of-the-mill hobby coder to be able to use your service, providing a package can get you that much more users. If you're more in business to business services, the webservice usually has to be integrated in some larger package and most libraries would be futile.
That being said, I'd say of the webservices I came across: about 60% of the libraries provided were hopeless spaghetti code fit for the bin, 30% were not the code I'd use, but could clear up some questions not answered by the documentation, and only about 10% were fit enough to integrate in a project (or the project small and/or worse enough to be no worse for it).
How you going to support multiple web-service stacks - JAX-WS, AXIS2, CXF etc? My choice - WSDL/XSD. In practice I got service built with JAX-WS and a client with AXIS2. And I don't want to build a client wich you are going to use. I don't even know your preferable web-service stack and your JVM version limitations. For example, I can call web-service from java 1.4 - there are no annotations and not possible to use client lib built with annotations for java 1.5. So WSDL is right way to build ws-client instead of providing generated client library.

Easy way to process batch data through web service?

What simple tools would you recommend to read a text file of addresses, send each record separately to a web service for geocoding, and save the batch of results as a text file?
Looking for no-frills component(s) with usage examples, for minimal code-from-scratch. Language irrelevant as long as dev environment is easy to install.
Requirements
- usable by unsophisticated programmer
- low or no cost
- runs under Windows.
Second thought:
How easy would this be to do inside a browser using JavaScript and a library or two?
I'd go for Java and use a flat file parsing library like jFFP or Flatworm
These libraries are pretty easy to understand and to use (I've worked with both of them in the past) and they both provide code samples.
Spring Integration would be another good option but the learning curve might be too big if you are not familiar with Spring and it might be overkill for your simple workflow.
Actually, in your case, I think I'd choose Flatworm for the parsing. You'll find code samples on its website or in How to read and parse flat files in Java. And you could even use it to write your output file like in Writing flat files in Java with Flatworm).
For the SOAP part, I'd use the JAX-WS Reference Implementation (which is included in the JDK 6 so you won't have to add any library if you are using Java 6) and Netbeans IDE. Netbeans IDE has very good support for developing JAX-WS Web Services Client (or here for later versions of Netbeans) and should really ease the process. Once the various classes generated, calling the web service is a matter of 3 lines of code as shown in the examples of the provided links:
// Call Web Service Operation
com.cdyne.ws.Check service = new com.cdyne.ws.Check();
com.cdyne.ws.CheckSoap port = service.getCheckSoap();
// TODO initialize WS operation arguments here
java.lang.String bodyText = "";
java.lang.String licenseKey = "";
// TODO process result here
com.cdyne.ws.DocumentSummary result = port.checkTextBody(bodyText, licenseKey);
Given the generic nature of the requirements, the relatively simple workflow, but its potential to bring a few twists and turns in the design (for example, the need of using https rather than http for webservices, the need of producing some odd token for authentication, or some fancy marshaling or conversion etc.) it might be best to use a modern script language. A very basic plan could be to use a plain shell script (a bat file), base on curl and a few other command line utilities, but this approach may not be flexible enough to deal with some requirements; instead languages such as Perl, PHP, Python, Ruby would be much preferable.
This would provide a low entry barrier, the ability to test elements of the application interactively before putting them into a formal script, and to leverage extensive libraries to deal with the various requirements that may arise, such as the storage of configuration parameters, parsing detail, output format, webservices, maths associated with geo positions etc. etc.
My inclination would be to use Python, but as said most other modern dynamic languages would do.
I would use XMLunit with Eclipse IDE, + JUnit, and JDK1.6 . A finished program that does this might only be 100 lines of code. It's doable by someone who is a novice programmer...
When the program is done you can compile as an .exe file for future use.
I would choose "Strawberry Perl" as my second choice for programming language. Python is slightly harder to use I think.