swagger/openapi 3.0 how choose server from configured array in YML - swagger

i am using OpenApi 3.0. I have configured multiple servers in my YML-File and i am now wondering how to determine which one to use at runtime.
Is there a way to choose a server from the configured array, or do i have to use the setBasePath method of the ApiClient. AFAIK only the first one is hardcoded into the generated Stubs.
Can Anyone give me a hint?
regards Pascal

Related

Eclipse Milo 0.2.0: Support for writing custom datatypes

I am evaluating Eclipse Milo 0.2.0 with the Unified Automation server and have successfully read&decoded my own custom structures (by registering appropriate codecs). However client.write keeps returning with status code Bad_WriteNotSupported. I could write the structure node with another client, though.
Does Milo not support writing custom structures yet? If not, when is this feature scheduled?
THX for your answers
The Milo Client SDK does support reading and writing custom structures. If they are registered correctly with the server you don't have to register them with Milo; it reads the datatype dictionaries from the server upon connecting.

Using spring-ws with already existing WSDL

I am new to spring-ws. what ever tutorial i see starts with xsd and at the end generates a wsdl. What is the approach when we have already an existing wsdl.
Also i was having a doubt on contract first approach which is already discussed (though am not getting convinced with the answer)
spring-ws and contract-first approach
My assignment is to use spring-ws with an existing wsdl. can you please provide me an approach for this.
As per my understanding. In the process of contract first approach, I got the contract already so how to proceed further is not shown in any tutorial.
When developing a web service using Java you can use one of two approaches:
Contract-first: start with an WSDL that defines the web service operations and their input/output messages. Then generate the corresponding Java objects to implement the service.
Contract last: Start with the implementation of one or more methods in Java and generate the WSDL files based on these methods and the Java objects that they use.
Spring-WS, as you already mentioned, only supports the contract first approach. This means that you cannot develop a web service using Spring-WS without first having a WSDL or XSD that describes the input/output messages.
You should be able to create a service using Spring-WS using any valid WSDL file. For a concrete example let me point you to a blog post that I created that illustrates how you can develop a web service using Spring-WS starting from a WSDL file.
Actually spring does support both static and dynamic wsdl. But each comes with different challenges. As from what i have seen, spring works on a notion of pattern matching when comes to generating a wsdl dynamically from a xsd. Like "Request" string which says input and "Response" means output. Now here is a problem where the spring generates a wsdl with synchronous responses. If our requirement is to have asynchronous response then the dynamic wsdl wont work.
To overcome this, we can use the static wsdl and let spring know not to generate wsdl dynamically.

Use neo4j server instead of embedded mode

I'm working on a webapp running on Tomcat which using spring-data to connect to a neo4j graph in embedded mode.
I would like to use neo4j server instead of the embedded mode and I am looking for some help to be sure about how to do that.
Some of my application services are quite difficult and combine, in a single transaction, the result of several cypher requests in a dto sent back to the user.
First I thought that I have to create a server unmanaged extension and I think I should follow these following steps.
- Keep my webapp with springMVC and spring security to hold and secure users sessions.
- Regroup all my transactional services in a specific jar my-app.jar
- Use Jax-RS to add a REST access point on each of my service of my-app.jar
- use something like spring restTemplate from my spring controller to call services from my-app.jar
First question : is this way of doing things is the good way ?
Second question : I have many spring injection in my services layer. How can I keep them working (how can I add dependencies in the server extension ?
Then I discovered graphAware and I wonder if I should use it instead.
And finally I just read this post http://jexp.de/blog/2014/12/spring-data-neo4j-improving-remoting-performance/ and it seems that I should use
the SpringCypherRestGraphDatabase (as explain in the bold text at the end of the article).
Well, I'm a little bit lost and I would appreciate any help to use neo4j server instead the embedded mode for my application which contain some complexe transactions.
You have a number of options here and you are on the right track with your thinking.
Option 1:
If your use cases are business-logic-heavy, and your question suggests that they are, going the unmanaged extension route is one option.
Essentially, you can then combine the most performant Java API and Cypher (if you wish) to perform your use case. I wouldn't use SDN here by the way, so you have to do your mapping manually, but is there really any mapping? Maybe you just want to execute traversals / Cypher queries for each one of your use cases.
Each use case then exposes a simple REST API, which is consumed by your Spring-powered application running Spring MVC, Spring Security, and all that. You can use the RestTemplate from Spring in your app's Controllers.
To add a twist to all that, you can use the GraphAware Framework to develop the "unmanaged extension" using Spring MVC as well. That would be my preferred option, knowing nothing about your domain/app.
Option 2:
Use the new version of SDN (v4) as Michael suggests. This allows you to run your application with annotated domain objects, Spring MVC, Security, et al. Operations (CRUD and other) are automatically translated to Cypher and sent across the wire to Neo4j running in server mode (no extensions needed). Results are then marshalled back to Java objects.
We're about to release Milestone 1 of SDN v4. It shouldn't take more than a week. That said, it is still going to be a Milestone release, thus not ready for production. A GA release is expected in May (ish).
You can already try SDN v4 yourself. Clone this repo: https://github.com/spring-projects/spring-data-neo4j, make sure you're on the 4.0 branch, and do an mvn clean install on it. Here's a sample app, built using Angular JS and Spring Boot.
Please do get in touch with feedback / questions / problems (best by email info at graphaware dot com). Cheers!
I suggest you wait a bit until SDN4 Milestone 1 comes out (developed by GraphAware) this was written from scratch for Neo4j-Server.

Connect to ActiveResource/ActiveRecord with a Delphi client

I've been looking for some way to let a Delphi program communicate with a RoR service. I could use any of the SOAP libraries out there e.g.: ActionWebService to offer a SOAP service, which I could then use in the Delphi program.
However, this requires one to reimplement all the ActiveRecord methods (such as find) over and over again. This is a hassle even if they are only delegation methods.
Who knows of a simpler / easier / cleaner way?
There is no such bindings, REST isn't a protocol but just convention over http.
I know about activeresource port for Java http://jactiveresource.org/ , but there is no such one for delphi. But you can watch sources of jactiveresource and try develop your own functionality. But you also can create rest client and wrap it with methods you need and unserialize responses into objects.
Here is a short example http://dn.embarcadero.com/article/40449
RoR use REST and MVC design paterns, that means you only need an HTTP client and an XML or JSON library.
I suggest you to watch this video to understand how it works.
http://www.youtube.com/watch?v=YCcAE2SCQ6k
You can keep using existing controllers, you just have to put "application/json" in the "Content-Type" HTTP header to post data and add .json instead of .html to get JSON data instead of HTML.

Calling Windows Service from a Web Service

I am using .Net 2.0 framework and would like to call a function in Windows service from a web service. Is this possible? And If yes, how much control I will have over the function i.e passing parameters, getting the result back etc. Any ideas would be greatly appreciated :)
Remoting is your best option if you need to pass parameter values.
If you don't need to share objects or anything too complex, ServiceController is probably easier.
You can do it through .NET remoting. If you go that route, it will appear you are calling a method and getting a result, but all your parameters will be serialized over the wire, and the result will be serialized back. Therefore, everything must be made serializable.
How about hosting a WCF service inside of the Windows Service. You can use net.tcp or named pipes to communicate between "your" web service and the one in the Windows Service. You can use the NetDataContractSerializer for serialization with type fidelity.
You could implement a basic http server that maps certain requests to functions. Query-string will be mapped to parameters. Actually not hard and I have done this in the past (as I provided some rudimentary template-based reporting). It wasn't dynamically, but it could be done dynamically. Look at HttpListener for a starting point. You could as well host the asp.net engine in it.
It has it advantages and disadvantages.
Why not package the function in its own DLL then distribute it with the Windows Service and the Web Service separately?
Create service project what export an interface COM or use PIPE to transfer data.
View this Interprocess Communication using Named Pipes in C#

Resources