-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use MicroProfile Rest Client with many parameters #286
Comments
Hi @jdang67 , I think there may be a typo in your configured base URI. The error message says it is trying to connect on port 8003, but you said that the service was listening on port 8083. You’ll probably just need to change the base URI in you MP Config or builder code. Other than that, everything else looks good to me. HTH, Andy |
Hi Andymc12, Yes, I made a mistake on the port #. However, it complains about the input param. // actual request that works
http://localhost:8083/geoserver/omi/ows?service=WFS&version=2.0.0&request=GetFeature&count=10&outputFormat=application%2fjson&exceptions=application%2fjson&propertyName=mmsi%2clat%2clon%2cdtg%2cimo%2ccall_sign%2cvessel_name&typeName=omi%3aais-enriched-stream&CQL_FILTER=(DWITHIN(geom%2c+POINT+(39.5783+121.2671)%2c+500%2c+Meters))
<ows:Exception exceptionCode="InvalidParameterValue" locator="service">
<ows:ExceptionText>No service: ( ows )</ows:ExceptionText>
</ows:Exception> And this is the actual interface @GET
@Path("/geoserver/omi/ows/")
@Produces(MediaType.APPLICATION_JSON)
public String getVesselsNearBy(@DefaultValue("WFS") @QueryParam("service") String service,
@DefaultValue("2.0.0") @QueryParam("version") String version,
@DefaultValue("GetFeature") @QueryParam("request") String request,
@DefaultValue("10") @QueryParam("count") String count,
@DefaultValue("application/json") @QueryParam("outputFormat") String outputFormat,
@DefaultValue("application/json") @QueryParam("exceptions") String exceptions,
@DefaultValue("mmsi,lat,lon,dtg,imo,call_sign,vessel_name") @QueryParam("propertyName") String propertyName,
@DefaultValue("omi:ais-enriched-stream") @QueryParam("typeName") String typeName,
@QueryParam("CQL_FILTER") String cqlFilter ); In this case, the only parameter that can be changed is the CQL_FILTER, the rest should be static. thanks, Jdang |
What value are you passing for the I've found that the best way to see what is sent from the client is to use a utility like tcptunnel ( https://github.com/vakuum/tcptunnel ). With this tool, you basically create a logging proxy - for example: Then you can change your baseURI in the MP Rest Client to point to localhost:10001 and you can see exactly what is sent and what is received. Different MP Rest Client implementations may also have different tracing options to see what exactly is sent, but generally I've found this approach to work fairly consistently - iirc, it does have problems with SSL/HTTPS though... HTH, |
Andy, The value of service param is "WFS" and currently supply by the @DefaultValue("WFS"). John |
John, Are you using the same interface for both the client and the server? The What I suspect is happening is that when you invoke the client, you may be passing null to the client interface parameter, expecting that the client implementation of the interface will then use the default value, but that is not currently a spec-defined behavior. Instead, what I suspect would happen is that the client implementation will generate a request that includes a query parameter like this: The tcptunnel approach should help determine what is actually sent to the server. HTH, |
Andy, Sorry for the late response since I have to implement the HttpClient by myself. John |
I would look at it as an opportunity to improve the design. ;-) It is probably too late to add support for One of the problems with supporting |
Hi Everyone,
I want to use MicroProfile Rest Client. However, I need to talk to the endpoint like the following:
http://localhost:8083/serviceName/sub/abc?p1=val1&p2=val2&p3=val3@p4=val4
and here is the
the base URL: http://localhost:8083
Using the URL directly always returns data while using rest-client throws exception:
Anything wrong with the way I use the MicroProfile Rest Client?
thanks,
Jdang
The text was updated successfully, but these errors were encountered: