Implement Jax ws in vertx with spring - spring-boot

I am trying to implement a soap service using jaxws with spring boot and vert.x. I couldn't find any way of doing it directly. Need to wrap ws in vertx. Have anyone faced it and could any one help me guiding to reference. Can we use service discovery in vert.x for the same?

I don't think that vert.x is a relevant solution to expose SOAP webservices, it's more appropriate to write Restfull or event based microservices (with the native event bus or a messages broker like Apache Kafka).
If you want to consume a SOAP webservice, I assume that you can use a CXF or Axis client like any java application.
Otherwise I didn't understand the relationship with springboot.

Related

Consuming CometD messages with spring webflux

We have a system which publishes messages via cometD.
I wrote a simple java program to establish a connection to the server
then use the bearer token returned from the login to and consume messages
But I want to move this to a Webflux project, but unsure where to start, I can see there is out of box JMS-webflux wrapper, can I use this or is it best to build something similar ?
I'm very new to cometD and have only used simple webflux components,
I can also just use Spring boot, but ideally just like a JmsReceiver or similar
Thanks

Camel Rest api consumer using SpringOAuthResttemplate

I have to invoke a couple of rest web service from my spring boot application. I am planning to use the Camel to configure the flow and other EIP use cases. Some of the endpoints are using oAuth2 authentication. I am planning to use the Spring oAuthResttempalte. All the examples on the internet are either using restlet, CXF or camel-http.
Camel Rest Consmer
I am not able to find a single example with just spring resttemplate. Did anyone implement Camel Rest consumer using Spring Resttemplate?
Some of the Examples on the internet use a jetty server to consume a rest endpoint. Why do you need a jetty server for simple rest consumer?
Did anyone implement Camel Rest consumer using Spring Resttemplate?
I'm not aware of that and it's unlikely to found something in that direction because Camel already have bult-in components to consume rest endpoints.
Some of the Examples on the internet use a jetty server to consume a rest endpoint. Why do you need a jetty server for simple rest consumer?
I believe that jetty was used as a consumer not a producer endpoint. So you won't need the "server". Or maybe you saw an example using jetty acting as a server to serve an OAuth endpoint?
If you excuse my approach, I'd suggest to remain with Camel HTTP/Rest capabilities to consume REST APIs using OAuth. I've found this example on Gist:
from("direct:authService").tracing()
.setHeader(Exchange.HTTP_PATH)
.simple("<auth service context>/oauth2/token")
.setHeader("CamelHttpMethod")
.simple("POST")
.setHeader("Content-Type")
.simple("application/x-www-form-urlencoded")
.setHeader("Accept")
.simple("application/json")
.setBody()
.constant("grant_type=client_credentials&client_id=<client id>&client_secret=<client sec>")
.to("https4://<remote auth service url>")
.convertBodyTo(String.class)
.log("response from API: " + body())
.choice()
.when().simple("${header.CamelHttpResponseCode} == 200")
.unmarshal().json(JsonLibrary.Jackson, AccessResponseToken.class)
.setHeader("jwt").simple("${body.access_token}")
.to("direct:<some direct route>")
.otherwise()
.log("Not Authenticated!!!");
If you want to stick into OAuthRestTemplate you may implement a Processor or a bean to wrap those calls and return to your route the authorization token.

Spring Boot Java8 Microservice Simple Message Subscription service

I am new to Microservice and JMS likes to know how can I
create a subscription
read the subscription
Using Spring Boot and JMS
To get started with Spring Boot and JMS use this getting started guide https://spring.io/guides/gs/messaging-jms/
Once you have that sorted then adding the microservices is just a matter of adding the Spring MVC and Rest components which you could first experiment as a standalone project and then integrate with the JMS application.
To get started with Spring Book and Microservices use the getting started guide https://spring.io/guides/gs/rest-service/
JMS not part of Java SE. You need Java EE or Spring.
I'm not sure queues are the best way to solve the problem.
I'd recommend Spring Boot.
Subscription maintenance isn't something that the queue would do.
A simple REST service would manage this nicely. You'll need a persistence layer to save subscription information.

Does Apache Camel work only with Apache CXF or Spring-WS?

I am trying to work on a PoC to replace an IBM WESB Proxy mediation (Exposed as a web service, Receives the soap request, Invokes different other Web Services based on the Soap Header passed in the request).
These web services are built using JAX-RPC and Spring framework running in WAS 7 container.
Is it possible to use Camel for this usecase? I don't want to migrate the underlying web services to CXF or SpringWS yet.
Does Camel have any URI's to solve this purpose? (like a web service adapter to call other non-CXF/non-SpringWS web services)
Any help is very much appreciated. Thanks.
First thing - If it is a RPC /ENCODED web service then you CANNOT call it even with cxf.There are ways that you can modify the rpc wsdl to use doc/literal but I would not suggest using that approach.
The simplest way to do this if you do not want to use cxf component or spring-ws is to create a java bean to invoke the Axis web service using the generated stubs.

Invoking soap services and rest apis using Dropwizard framework

I have a requirement to expose my business logic in RESTFul API. One of my colleague mentioned Dropwizard seems to be quite good. However i would like to know if it suits my requirements. My requirement is to invoke multiple SOAP services and REST APIs to build the application logic.
Does dropwizard have anything native support for consuming soap services / rest apis ?
or
i should integrate with other frameworks like Spring, CXF ? If i use CXF or Spring, i am aware that i will need to generate the JAXB annotated classes, Service endpoint interfaces etc, provide cxf beans and inject the dependencies into my code and implement business logic.
Pls let me know if the requirements can be met with just dropwizard without any other frameworks like spring, cxf etc ?
Thanks a lot for your help.
Yes, you can invoke external REST Services using this library
dropwizard-client
Demo example is given in this manual.

Resources