communication with two web services using came and spring boot - spring-boot

Hi I am new to camel and I want to communication with two web services my requirement is :
array of object pass to one web service
array[0] have school details so it will save in database using spring rest call("/register")
array[1] have admin details so need to save in admin database using other spring rest service ("/register-admin") and generate username and password and return
I am trying to do that by using ("rest:post:register") but camel and spring boot has started on different port so 404 getting
I used ("jetty:{uri}") also but it is not working and if it will work then how we will pass object via request body
please help me to solve
thank you very much in advance

You can try use the http4 component with bridgeEndpoint=true, like this.
.toD("http4//yourUrl?bridgeEndpoint=true");
I always do this way.

Related

mimic swagger api on spring boot application

I got a Spring boot REST based proxy server application with standard REST End point exposed(GET, POST,PUT and DELETE) to outside world.
Any requests coming from external world then will be routed to actual functionality internally.
Now the requirement is to expose all the API supported by my REST proxy server. As I mentioned I do not have static controller path in my code for individual APIs. So would like to get your input how to create swagger support for all the internal APIs that my proxy server support. Is there are a way I can generate swagger schema manually to mimics the controller path? Or is there any other way to solve this problem?
Thanks in advance.

how to make spring mvc functions available for rest calls

I have a spring mvc application which runs correctly,now another colleague wants to call the same functions from another application but he needs REST URL of my functions.
how is it possible to provide the same functionality through spring REST?
is it just with new annotations .please provide some resource to show me how to do it.
when server has a service, only legal clients which had any contracts with server can access it. And clients can use service by the way such as: use RestTemplate to get/post request to URL of service, and clients can get data as JSON, or XML type if you have an equivalent object as this image:
Also, a service can be support as a interface, ex: google search is a service supported by google, but it's not rest service.
If you know each other URL address you can consume each other REST API from java code by using RestTemplate object.
I would advise you to go over the Spring starter guide which deals with that issue, here is the link (Consuming a RESTful Web Service):
https://spring.io/guides/gs/consuming-rest/

Spring XD REST Service

I would like to have a REST service to expose the data read and processed from Spring XD. Similar to the one in the Analytics Server.
For example I would like my own functions which can be exposed similar to Counters and be able to access the data from a web browser.
Is there any tutorial? I have searched and found that Spring Boot is the one but I am looking for help on how I integrate it with Spring XD.
Would be very helpful if someone can point me to the instructions on how I can achieve this.
You can use trigger as a source with http-client as a processor processor to access any web browsers info regardless if it is a web service URL or not.
Moha.

Spring Boot REST JSP

I have a working Spring BOOT application that has a custom security provider and REST API controllers. I would also like to add a GUI interface to the application for access from a browser through jsps, html, and a login page which uses my existing custom security provider I used with the REST APIs. Maybe using Spring MVC since that is needed for the REST API support. I could not find a single example of doing this on the web. Also, I do NOT want to use any web XML based configuration files - as I am currently only using Java config for the implementation of the REST APIs. I am also currently using SSL for REST API access through SSL in a Jetty embedded web container. Please help if you can? Thanks in advanced.
Paul there is a rather large amount of information on view technologies that are compatible with Spring BOOT. You need to decide what you want to use and do relevant research for it.
As a guiding hand here check this page out for just one of the many types:
http://kielczewski.eu/2014/04/spring-boot-mvc-application/
You may follow this procedure :
lets assume that u have an endpoint for which you need both REST and view controllers,your REST endpoint exposes your data in JSON as RESTController and your view Endpoint returns the view name as Simple old controller.
lets say your base url is at localhost:8080 and your endpoint of interest is /students
you could have both in same application but at different endpoints like this :
REST : localhost:8080/api/v1/students -- exposes json
VIEW : localhost:8080/students -- returns a view
hope this make clear ..

Spring CXF Client Test

I am working on sending a request to a web service and parsing the response. I have to use Spring 3 and Apache CXF. Using Maven's wsdl2java, I was able to generate request and response objects from the wsdl. These classes have been generated now and I see basically what appear to be annotated POJO's. I am unclear what the next step is to actually send the request to the web services. All I see is an ObjectFactory to create the initial web service.
What is the next step? Do I need to create a spring bean configuration file like this?
<jaxws:client id="XXXX"
serviceClass="XXXX"
address="http://localhost:8080/xxxx />
Any assistance would be greatly appreciates as I am not sure how to send the actual request to the web or what my next step would be. Thanks
If you want to look the webservice without using spring you can use the stubs generated & make a call to the service in a program with main. Something like..
http://61.153.44.88/apache/cxf/2.0/developing-a-consumer.html
If you want to use spring, see "Create a Client" section here
http://cxf.apache.org/docs/writing-a-service-with-spring.html
There is a post here with an example of how to create a CXF Client and server and integrate it with Spring.

Resources