ottfro1 commented on issue #7977: URL: https://github.com/apache/camel-quarkus/issues/7977#issuecomment-3543462538
> https://cxf.apache.org/docs/openapifeature.html yes https://cxf.apache.org/docs/openapifeature.html at the bottom of that page there are samples More examples on how to process requests and write responses can be found https://github.com/apache/camel/tree/main/components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding They may not mention WSDL to generate JAXB classes - I think they (apache cxf) have created their JAXB classes by hand coding them. We use contract first WSDL. One of our methods in the service class typically looks like the following In the annotations we refer the JAXB service classes for soap request, response and fault (which are generated by WSDL2java) which is then reflected in the OpenAPI specification. This is the simplest case where we have json in both request and response. sometimes we create the request jaxb from query parameters or http headers instead of mapping from json. In the method we have Inputstream as input - so when using the camel-cxf-rest (cxfrs) - we get the json payload available in the camel flow/route and we can then convert the json payload using the jackson objectmapper -> JAXB -> marshal -> XML. we have many more annotations on classlevel to get more info into the OpenAPI specification. We have no code in the service class - the processing happens in the camel flow/route @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path(SERVICE_PREFIX + SERVICE_Create) @POST @Tag(name = "DamageNotification") @Operation( summary = "CreateRequest, Operation=Create", description = "Create Request operation with successful payload response or application fault", parameters = { @Parameter(in = ParameterIn.HEADER, name = "X-Trace", required = true, description = xTraceDescription, schema = @Schema(type = "string", format = "string", example = xTraceExample, description = xTraceDescription)) }, requestBody = @RequestBody(description = "CreateRequestType, returns successful payload response or fault", required = true, content = @Content( mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = se.eon.grp411.int201.v1.damagenotification.CreateRequestType.class) )), responses = { @ApiResponse( headers = { @Header(name = "pomessageid", description = poMessageIdDescription, required = true, schema = @Schema(type = "string", format = "uuid", description = "The generated uuid")), @Header(name = "x-trace", description = xTraceDescription, required = false, schema = @Schema(type = "string", format = "string", description = "X-Trace returned to sender")) }, content = @Content( mediaType = MediaType.APPLICATION_JSON, //schema = @Schema(type = "string", format = "reference", required = true, minLength = 1, title = "reference", description = "Reference number of created engagement") schema = @Schema(implementation = se.eon.grp411.int201.v1.damagenotification.CreateResponseType.class) ), responseCode = "200", description = "Ok" ), @ApiResponse( headers = { @Header(name = "pomessageid", description = poMessageIdDescription, required = true, schema = @Schema(type = "string", format = "uuid", description = "The generated uuid")), @Header(name = "x-trace", description = xTraceDescription, required = false, schema = @Schema(type = "string", format = "string", description = "X-Trace returned to sender")) }, content = @Content( schema = @Schema(implementation = se.eon.grp411.int201.v1.damagenotification.ESVFMI411201DamageNotification.class), mediaType = MediaType.APPLICATION_JSON ), responseCode = "400", description = "Application Error" ), @ApiResponse( headers = { @Header(name = "pomessageid", description = poMessageIdDescription, required = true, schema = @Schema(type = "string", format = "uuid", description = "The generated uuid")), @Header(name = "x-trace", description = xTraceDescription, required = false, schema = @Schema(type = "string", format = "string", description = "X-Trace returned to sender")) }, content = @Content( schema = @Schema(implementation = se.eon.grp411.int201.v1.damagenotification.ESVFMI411201DamageNotification.class), mediaType = MediaType.APPLICATION_JSON ), responseCode = "500", description = "Error" ) } ) //@Parameter(required = true, example = xTraceExample, description = xTraceDescription) @HeaderParam("X-Trace") final String XTrace, //@RequestBody(description = "QueryRequestType, choice Person or Organisation as input. returns successful payload response or fault", // required = true, content = @Content(schema = @Schema(implementation = se.eon.grp800.int222.v3.legalparty.QueryRequestType.class))) se.eon.grp800.int222.v3.legalparty.QueryRequestType startDigitalSigningRequest) //public Response createRequest(se.eon.grp411.int201.v1.damagenotification.CreateRequestType createRequest) public Response createRequest( // @Parameter(required = true, example = xTraceExample, description = xTraceDescription) @HeaderParam("X-Trace") final String XTrace, // // @RequestBody(description = "CreateRequestType, returns successful payload response or fault", required = true, // // content = @Content( // mediaType = MediaType.APPLICATION_JSON, // schema = @Schema(implementation = se.eon.grp411.int201.v1.damagenotification.CreateRequestType.class) // // )) //se.eon.grp411.int201.v1.damagenotification.CreateRequestType createrequest java.io.InputStream is ) { return null; } in the endpooint we use bindingStyle=SimpleConsumer which makes is much simpler In the cxfrs https://camel.apache.org/components/4.14.x/cxfrs-component.html We build erndpoint like this Before we create and bind to registry "#" + ZJAXBJSONPROVIDER+ "," + "#" + ZMULTIPARTPROVIER + "," + "#" + ZAPIORIGINFILTER Also create and configure the openApiFeature CxfRsEndpointBuilder builder = cxfrs("http://localhost:" + CXT + "/zresti411?bindingStyle=SimpleConsumer"); builder = builder.providers("#" + ZJAXBJSONPROVIDER+ "," + "#" + ZMULTIPARTPROVIER + "," + "#" + ZAPIORIGINFILTER); builder = builder.features(Arrays.asList(openApiFeature)); builder = builder.resourceClasses(String.join(",",llResourceCLasses)); builder = builder.loggingFeatureEnabled(true); CxfRsEndpointProducerBuilder zzz = builder.throwExceptionOnFailure(true); Endpoint endPoint = builder.resolve(getCamelContext()); -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
