osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Camel CXFRS and Swagger/OpenAPI Feature


Done:
https://issues.apache.org/jira/browse/CAMEL-12957

Cheers,
Jens

Inactive hide details for "Zoran Regvart" ---22.11.2018 20:09:16---Hi Sergey, I think we might have that as an option, though i"Zoran Regvart" ---22.11.2018 20:09:16---Hi Sergey, I think we might have that as an option, though if Camel simply

Von: "Zoran Regvart" <zoran@xxxxxxxxxxx>
An: users@xxxxxxxxxxxxxxxx,
Datum: 22.11.2018 20:09
Betreff: Re: Camel CXFRS and Swagger/OpenAPI Feature




Hi Sergey,
I think we might have that as an option, though if Camel simply
returns what the resource method generates, why have it pass through
Camel at all? Perhaps I don't fully understand the use case.

I think it's quite easy to mix purely JAX-RS implemented resources and
Camel implemented ones.

Sergey and Jens, if you think we should improve on this, can you
please create a JIRA issue and describe a brief use case where this
would be a good addition to Camel CXFRS component.

thanks & keep riding :)

zoran

On Tue, Nov 20, 2018 at 6:31 PM Sergey Beryozkin <sberyozkin@xxxxxxxxx> wrote:
>
> As far as I recall, a corresponding CXF filter is a blocking one and
> returns a JAX-RS Response. May be the CamelCXF RS code needs to be tweaked
> a bit to check if JAX-RS Response is already available before continuing
> with the route flow...
>
> Cheers, Sergey
>
>
> On Tue, Nov 20, 2018 at 5:20 PM #S-SmixDev <smixdev@xxxxxxxxx> wrote:
>
> > Hi Zoran,
> >
> > yeah, I suspected that might be the way it's supposed to work, but the
> > problem here of course is that I don't actually have a ResourceImpl of my
> > real service, only an interface, and therefore performInvocation doesn't
> > work for me unless I write a Dummy implementation, too.
> >
> > Cheers,
> > Jens
> >
> > [image: Inactive hide details for "Zoran Regvart" ---20.11.2018
> > 17:28:53---Hi Jens, from the little exploration I did I think you need]"Zoran
> > Regvart" ---20.11.2018 17:28:53---Hi Jens, from the little exploration I
> > did I think you need to set
> >
> > Von: "Zoran Regvart" <zoran@xxxxxxxxxxx>
> > An: users@xxxxxxxxxxxxxxxx,
> > Datum: 20.11.2018 17:28
> > Betreff: Re: Camel CXFRS and Swagger/OpenAPI Feature
> > ------------------------------
> >
> >
> > Hi Jens,
> > from the little exploration I did I think you need to set
> > `performInvocation` to `true`: the way OpenAPI support in CXF works is
> > by registering a resource that will generate the OpenAPI
> > specification, and that JAX-RS resource class[1] has an `getOpenApi`
> > method.
> >
> > So your routes need to look something like this:
> >
> > from("cxfrs://
> >
http://localhost:8080/api?features=#openApi&resourceClasses=...&performInvocation=true
> > ")
> > .toD("direct:${header.operationName}");
> >
> > from("direct:getOpenApi").log("Fetching OpenAPI specification");
> >
> > The `log` here is just in place of a dummy processor so that the route
> > has a `from` and a `to`.
> >
> > The way I came to think of it is that the resource classes give the
> > REST API shape, and the implementation is provided by Camel route,
> > which is kinda difficult to grasp since the most natural thing would
> > be to write the implementation within the resource method.
> >
> > zoran
> >
> > [1]
> >
https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/integration/resources/OpenApiResource.java#L28
> > On Mon, Nov 19, 2018 at 2:03 PM #S-SmixDev <smixdev@xxxxxxxxx> wrote:
> > >
> > >
> > > Hi Camel Riders,
> > >
> > > I'm trying to integrate a Camel-CXFRS endpoint with Swagger UI using the
> > > Swagger/OpenAPI Feature.
> > >
> > > This works fine with a "pure" CXF endpoint, no Camel involved.
> > >
> > > When using Camel-CXFRS, however, I can't make it work properly without
> > > extra implementation work in the Camel route.
> > >
> > > Using runAsFilter=false a call to
> > >
http://localhost:8080/services/myCamelService/openapi.json
> > > results in a call of the Camel route with an operation "getOpenApi"
> > >
> > >
http://localhost:8080/services/myCamelServive/api-docs?url="">
> > > results in call of the Camel route with an operation "getResource"
> > >
> > > Using runAsFilter=true the situation improves marginally:
> > >
http://localhost:8080/services/myCamelService/openapi.json
> > > still results in a call of the Camel route with an operation "getOpenApi"
> > >
> > >
http://localhost:8080/services/myCamelServive/api-docs?url="">
> > > at least now shows the Swagger UI page frame but still fails to load the
> > > actual service description since it again calls the Camel route with the
> > > "getOpenApi" operation.
> > >
> > > As far as I can see, calling the API description endpoints should not
> > > involve the Camel route at all, and this "getOpenApi" call should instead
> > > happen on the internal service resource.
> > >
> > > Has anyone successfully set this up just using the CXF feature out of the
> > > box? Is this even possible?
> > >
> > > Cheers,
> > > Jens
> > > ___________________________________________________________________
> > >
> > > DZ BANK AG
> > > Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main
> > > Platz der Republik, 60325 Frankfurt am Main
> > > Deutschland/Germany
> > >
> > >
https://www.dzbank.de
> > >
mailto:mail@xxxxxxxxx <mail@xxxxxxxxx>, T +49 69 7447 01, F +49 69 7447
> > 1685
> > >
> > >
https://twitter.com/dzbank
> > >
> > > Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief
> > Executive Officer),
> > > Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler,
> > > Dr. Cornelius Riese, Michael Speth, Thomas Ullrich
> > >
> > > Generalbevollmächtigter/General Executive Manager: Uwe Fröhlich
> > >
> > > Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Henning
> > Deneke-Jöhrens
> > > Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt
> > am Main
> > > Handelsregister/Register of Companies: HRB 45651.
> > >
> > > ___________________________________________________________________
> > >
> > > Die mit dieser E-Mail-Kommunikation erhobenen personenbezogenen Daten
> > > werden ausschließlich zu diesem Zweck bzw. zur Bearbeitung Ihres
> > Anliegens weiterverarbeitet.
> > > Weitere Informationen zum Datenschutz finden Sie unter
> >
https://www.dzbank.de/datenschutzhinweise
> > >
> > > The personal data collected by this e-mail communication
> > > are processed exclusively for this purpose or to process your request.
> > > Further information on data protection can be found at
> >
https://www.dzbank.com/dataprotection
> >
> >
> >
> > --
> > Zoran Regvart
> >
> > *DZ BANK AG*
> > Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main
> > Platz der Republik, 60325 Frankfurt am Main
> > Deutschland/Germany
> >
> >
https://www.dzbank.de
> >
mailto:mail@xxxxxxxxx <mail@xxxxxxxxx>, T +49 69 7447 01, F +49 69 7447
> > 1685
> >
> >
https://twitter.com/dzbank <https://www.twitter.com/dzbank>
> >
> > Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief Executive
> > Officer),
> > Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler,
> > Dr. Cornelius Riese, Michael Speth, Thomas Ullrich
> >
> > Generalbevollmächtigter/General Executive Manager: Uwe Fröhlich
> >
> > Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Henning
> > Deneke-Jöhrens
> > Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt am
> > Main
> > Handelsregister/Register of Companies: HRB 45651.
> >
> > ___________________________________________________________________
> >
> > Die mit dieser E-Mail-Kommunikation erhobenen personenbezogenen Daten
> > werden ausschließlich zu diesem Zweck bzw. zur Bearbeitung Ihres Anliegens
> > weiterverarbeitet.
> > Weitere Informationen zum Datenschutz finden Sie unter
> >
https://www.dzbank.de/datenschutzhinweise
> >
> > The personal data collected by this e-mail communication
> > are processed exclusively for this purpose or to process your request.
> > Further information on data protection can be found at
> >
https://www.dzbank.com/dataprotection
> >



--
Zoran Regvart


DZ BANK AG
Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main
Platz der Republik, 60325 Frankfurt am Main
Deutschland/Germany

https://www.dzbank.de
mailto:mail@xxxxxxxxx, T +49 69 7447 01, F +49 69 7447 1685

https://twitter.com/dzbank

Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief Executive Officer),
Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler,
Dr. Cornelius Riese, Michael Speth, Thomas Ullrich

Generalbevollmächtigter/General Executive Manager: Uwe Fröhlich

Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Henning Deneke-Jöhrens
Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt am Main
Handelsregister/Register of Companies: HRB 45651.

___________________________________________________________________

Die mit dieser E-Mail-Kommunikation erhobenen personenbezogenen Daten
werden ausschließlich zu diesem Zweck bzw. zur Bearbeitung Ihres Anliegens weiterverarbeitet.
Weitere Informationen zum Datenschutz finden Sie unter https://www.dzbank.de/datenschutzhinweise

The personal data collected by this e-mail communication
are processed exclusively for this purpose or to process your request.
Further information on data protection can be found at https://www.dzbank.com/dataprotection