Polarion Web services API - How to create a project? - api

Looking at the list of available polarion webservices wsdl api functions, I don't see one for creating a polarion project. I have had no luck in finding out how I can create a polarion project via scripting to the polarion soap (wsdl) API.

It is not possible.
I was looking through the (in my opinion) three relevant classes when it comes to using the API and I could not find a createProject method.
The three relevant classes are:
http://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/ws/client/projects/ProjectWebService.html
http://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/ws/client/session/SessionWebService.html
http://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/ws/client/tracker/TrackerWebService.html
There is a createProject method however in the following interface
but importing that did also not work. It is not part of ws/client so I think the method is only ment to be implemented in Polarion Wikipages with Velocity Code.
http://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/projects/IProjectLifecycleManager.html

Related

Does GeneXus have the functionality to call external program's APIs?

I understand GeneXus has the 'External Object' feature, which I can only assume is used for setting up API calls, however, I can't seem to find any documentation online for doing this. I have an external software and I wish to run a GET API call (ie api.domain.com/example) and input the received data into a transaction in my GeneXus software. Any way of doing this?
For calling HTTP APIs you should use the HttpClient Data Type.
&httpclient.Host = "labs.genexus.com"
&httpclient.BaseUrl = "/mobilecrm/rest/"
&httpclient.Execute('GET','WorkWithDevicesCompany_Company_List_Grid?fmt=json')
&companies.FromJson(&httpclient.ToString() )
Look at this sample
External Objects are used to integrate native objects, such as External Programs packaged as DLLS (.NET) or JARs (JAVA). This seems not to be your case.

Spring Auto REST Docs + Spring Data REST? HATEOAS?

I really like the idea of using Javadoc comments for auto-generating REST Docs!
Huge parts of our REST API are automatically generated by Spring Data REST (by adding #RepositoryRestResource to Repositories). It would be great if REST Docs could also be generated for these - that would be a very high degree of automatition.
But unfortunately most "auto-"snippets are "empty" (e.g. auto-response-fields.adoc only contains a list of links[]-Attributes). I guess the reason could be that the REST Controllers are probably created dynamically by Spring Data REST. Currently I do not see how to re-use the Javadoc comments for them.
Is there any way to auto-generate REST Docs for such REST APIs that are provided by Spring Data REST?
It would even be helpful to manually tell Spring Auto REST Docs which classes are used in requests and responses instead of letting it discover it statically - is that possible?
And we also add HATEOAS "_links" to most response Resources (by providing ResourceProcessors as Beans). These links contain "title"s which are used by Spring REST Docs - if we list all of them with HypermediaDocumentation.linkWithRel(...). This is a bit redundant, and it would be nice if all the _links with "title"s could be processed automatically. (But this can be done by listing all of them in some extra code, so it is not as bad as with Spring Data REST.)
If necessary, I could also create an example project for what I am talking about.
Answer to the question whether one can manually tell Spring Auto REST Docs which classes to use for the documentation:
Spring Auto REST Docs allows to specify the request and response classes to use for the documentation. This can be done with requestBodyAsType and responseBodyAsType. In a test it looks like this:
.andDo(document("folderName",
requestFields().requestBodyAsType(Command.class),
responseFields().responseBodyAsType(CommandResult.class)));
This is from a test in the example project.

What is the difference between a cornice.Service and cornice.resource in Cornice?

I have read through the documentation many times over and search all over for the answer to this question but have come up short. Specifically I've looked at Defining the service and the Cornice API for a service and at Defining resource for resource.
I'm currently building a REST API that will have a similar structure to this:
GET /clients # Gets a list of clients
GET /clients/{id} # Gets a specific client
GET /clients/{id}/users # Gets a specific clients users
What would be the best way to go about this? Should I use a service or a resource or both? And, if both, how?
Resources are high-level convenience, services offer lower level control.
I am just learning cornice myself. Looking at the source code, a Resource creates Services internally, one for the item and one for the collection (if a collection path is specified). The resource also adds views to the services for each method defined with an http verb as the name or in the form collection_[verb].
So there is little difference except that resources are a neat, structured way to define services.
The resource decorator uses a url for the collection, as well as a url pattern for an object.
collection_path=/rest/users
path=/rest/users/{id}
The resource decorator is best used in view classes where you can use get/put/post/delete methods on the objects, as well as collection_get, collection_put, etc. on the collection. I have some examples here:
https://github.com/umeboshi2/trumpet/blob/master/trumpet/views/rest/users.py
Since I make heavy use of the resource decorator and view classes, I haven't found a need for the service function, but it allows you to create get,put,post decorators that wrap view callable functions.
If you are using backbone.js on the client side, the resource decorator and url examples work well with the Backbone collections and models.

ASP.NET Web Api and Data Contracts

I want to create a client for this public WEB API. I am new to this and I was going through this MSDN tutorial. I noticed that there are no Data Contracts defined and i cannot add service reference in my project. In the tutorial in some point it says create this class (Product) as data object that HttpClient will use.
How can i find/create this class when using the public API. In WCF i can add service reference and i will get client classes created from the service data contract. How is this done in Web Api?
As illustrated in the MSDN article, since there's no defined contract (unlike WCF) you're gonna need to create the appropriate Types first in order to be able to consume it using REST client.
However, there are some shortcuts you can use, see here:
Generate Contracts for REST objects
Also, you may find RestSharp easier to use than the official WebApi client.

Hosting a service with WCF from WSDL - SVCUtil generates verbose types for methods

I have a WSDL file from a published ASMX web service. What I am after
is creating a mock service that mimics the real service for testing purposes.
From the WSDL, I used SvcUtil.exe to generate code. Apparently it also generates
the server side interface.
Well the issue is that it generates very chunky interfaces. For example, a method
int Add(int, int) is showing up in the generated .cs file as AddResponse Add(AddRequest). AddRequest and AddResponse have a AddRequestBody and AddRequestResponse and so on.
The issue is that, to implement, I need to create the body and response instances for each method, even when I just want to return a simple int result.
Why can't it generate the method signature properly? Is there a better way of generating WCF Server side interface/contracts from WSDL?
The message structure you are describing is caused by two things:
better interoperability across web service stacks and their programming models (RPC vs messaging);
flexibility to accommodate new parameters into existing web services.
You are not the first one to complain about it, or the last. It's a WSDL binding style commonly called the document/literal wrapped pattern. It produces document/literal web services and yet also supports an RPC programming style. It's very "WS interoperability friendly", so to speak...
The WS-I Basic profile specifies that the soap:body must have only one child element and in this case it's a wrapper for the operation name that's being invoked. The parameters of the call are packed into only one element as a best practice since it's more flexible to later changes. In case of WCF you usualy end up with a MessageContract which has one MessageBodyMember which wraps all the parameters.
Basically, you are seeing the results of web service battles fought long time ago.
Here is some extra reading on the subject (and that's just the tip of the iceberg):
Which style of WSDL should I use?
RPC/Literal and Freedom of Choice
My Take on the Document/Literal 'Wrapped' Idiom