grpc-swagger / grpc-swagger Goto Github PK
View Code? Open in Web Editor NEWDebugging gRPC application with swagger-ui.
License: MIT License
Debugging gRPC application with swagger-ui.
License: MIT License
I dont know what else to add))
If we send http headers via swagger ui http requests, those headers are not mapped into grpc calls on metadata structure.
大神帮忙看一下,感谢🙏
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Error in server reflection rpc while listing services
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:528)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:509)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:85)
at io.grpc.grpcswagger.utils.GrpcReflectionUtils.resolveServices(GrpcReflectionUtils.java:43)
at io.grpc.grpcswagger.service.Test.getont(Test.java:37)
at io.grpc.grpcswagger.service.Test.main(Test.java:30)
Caused by: java.lang.RuntimeException: Error in server reflection rpc while listing services
at io.grpc.grpcswagger.grpc.ServerReflectionClient$ListServicesHandler.onError(ServerReflectionClient.java:106)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:434)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCa
大佬你好,我通过postman访问
http://localhost:8080/io.grpc.grpcswagger.demo.HelloService.helloWorld
调用 helloWorld 这个方法,报了Unable to find method helloWorld in service HelloService
这个错
我通过http://localhost:8080/listServices
可以看到 HelloService 这个服务,方法也是在.proto
文件中定义过的(直接使用的该项目的例子)
请问大佬,我是哪里弄错了吗
自动获取当前api接口的hostport,不再配置
when I put the location:http://localhost:8080/swagger-ui.html in the brower.
I got the follow excetpion:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Nov 05 10:52:14 CST 2019
There was an unexpected error (type=Bad Request, status=400).
Required request body is missing: public io.grpc.grpcswagger.model.Result<java.lang.Object> io.grpc.grpcswagger.controller.GrpcController.invokeMethod(java.lang.String,java.lang.String)
org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public io.grpc.grpcswagger.model.Result<java.lang.Object> io.grpc.grpcswagger.controller.GrpcController.invokeMethod(java.lang.String,java.lang.String)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:160)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:126)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:166)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
感谢这个项目。
https://github.com/grpc-swagger/grpc-swagger/blob/master/grpc-swagger-demo/pom.xml
中
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:1.16.1:exe:${os.detected.classifier}
</pluginArtifact>
1.16.1 不能生成 HelloServiceGrpc.java,改成 1.13.1 再先后点击
Plugins/protobuf/protobuf:compile
Plugins/protobuf/protobuf:compile-custom
才能生成
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Sep 04 22:30:59 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
How to add header when calling grpc?
UseCase:
we are using jwt as head parameter(grpc md) to identify user info. So it's required to pass jwt token into md when debuging grpc.
How to do this in grpc-swagger?
how to set metadata, It's not work when set it in header
This seems like a great idea. Thanks for your efforts!
Regretfully, can't do the simplest test. Probably something I don't get, but I follow step by step and fail.
I have helloworld server started, testing it with evans and it works OK, here's .cap
evans.zip
But when I try to register this server with grpc-swagger, I get an error. Attached screenshot, log, cap:
grpc-swagger-fail.zip
You both do list_services (your for empty string, evans
for *), and get same reply (as far as I can tell).
But then evans
proceeds to inquire about individual services, while you don't.
Any ideas?
Maybe I could do something to further diagnose this?
Thanks in advance for any response!
Alex
I’m developing a generic JVM client for gRPC, that can be used from code (primarily for testing), and in the terminal as an executable JAR. If you are willing, you are welcome to collaborate with me (in which case you’ll no longer need to main the grpc-swagger-core
module) by using the client I developed. Further changes will then be done in the okgrpc-client
.
https://github.com/asarkar/okgrpc
I looked at your core module, and I’ve lot more test coverage and simpler API. Like you, I was also inspired by polyglot project.
Good effort on this project, you’ve done a lot.
First thanks for the tool. But exist any possibility to auto register the services and present all endpoints of all services in a unique swagger view to not to have to select one service one by one?
Regards
My question is very simple
My GRPC server is configured in Sprinboot application using Annontation to the controller.
@GRpcService
public class DocumentServiceController extends DocumentServiceImplBase {
....
...
...
}
how to access swagger-ui.html
like http://ui.grpcs.top/#/
does?
I only have grpc-swagger-web
and a running grpc services.
"attribute infoObject is unexpected",
"attribute info is missing",
if message defined in a message, "Models" and Example Value can not show them
message HelloRequest {
string name = 1;
Text text = 2;
message Text
{
string lang = 1;
}
}
if message contends "bytes" , how can I send data?
message HelloRequest {
string name = 1;
bytes data = 2;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.