[
https://issues.apache.org/jira/browse/CAMEL-21057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17872025#comment-17872025
]
Lukas Lowinger commented on CAMEL-21057:
----------------------------------------
[~zhfeng] With Cemel 4.7.0 it fails with different error
{code}
[el-1) thread #1 - timer://test] TimerConsumer WARN Error
processing exchange. Exchange[5DDB809D0CED7B5-0000000000000000]. Caused by:
[org.apache.camel.http.base.HttpOperationFailedException - HTTP operation
failed invoking http://localhost:8080/api/v3/api/v3/pet with statusCode: 404]
org.apache.camel.http.base.HttpOperationFailedException: HTTP operation failed
invoking http://localhost:8080/api/v3/api/v3/pet with statusCode: 404
{code}
> REST OpenApi fails to resolve host from the URL
> -----------------------------------------------
>
> Key: CAMEL-21057
> URL: https://issues.apache.org/jira/browse/CAMEL-21057
> Project: Camel
> Issue Type: Bug
> Components: camel-rest-openapi
> Affects Versions: 3.18.8
> Reporter: Lukas Lowinger
> Priority: Minor
> Attachments: rest-openapi-camel.zip
>
>
> Given simple route
> {code}
> private final String openApiJsonUrl =
> "http://localhost:8080/api/v3/openapi.json";
> String a = "{\n" + " \"id\": 13,\n" + " \"name\": \"kooo\",\n" + "
> \"category\": {\n" + " \"id\": 1,\n" + " \"name\": \"Dogs\"\n" + "
> }\n" + "}";
> @Override
> public void configure() throws Exception {
>
> from("timer:test?repeatCount=1").setBody(simple(a)).setHeader(Exchange.CONTENT_TYPE,
> simple("application/json")).to("rest-openapi:#addPet?specificationUri=RAW("
> + openApiJsonUrl + ")").to("direct:readPet");
> from("direct:readPet").setHeader("petId",
> simple("13")).to("rest-openapi:#getPetById?specificationUri=RAW(" +
> openApiJsonUrl + ")");
> }
> {code}
> I get
> {code}
> Caused by: java.net.MalformedURLException: no protocol: /api/v3
> at java.net.URL.<init> (URL.java:674)
> at java.net.URL.<init> (URL.java:569)
> at java.net.URL.<init> (URL.java:516)
> at
> org.apache.camel.component.rest.openapi.RestOpenApiEndpoint.determineHost
> (RestOpenApiEndpoint.java:590)
> at
> org.apache.camel.component.rest.openapi.RestOpenApiEndpoint.determineEndpointParameters
> (RestOpenApiEndpoint.java:459)
> {code}
> Reproducer:
> # Unzip [^rest-openapi-camel.zip]
> # Run `docker run -p 8080:8080 swaggerapi/petstore3`
> # mvn camel:run
--
This message was sent by Atlassian Jira
(v8.20.10#820010)