I can't find any example in scala/java where the server side is accessing the context of a grpc request (with scalapb / grpc.io). I can find many examples in golang. I found some of with akka grpc but I am using scalapb and grpc.io
If anyone knows of a repo in github that uses it or can layout the steps needs to access it, it would be very kind of you
In grpc-java and ScalaPB you get access to the request's metadata through client and server interceptors. See: https://grpc.github.io/grpc-java/javadoc/io/grpc/ServerInterceptor.html
Example: https://github.com/saturnism/grpc-java-by-example/tree/master/metadata-context-example/src/main/java/com/example/grpc/server
Related
I have created a sample play framework api which has one endpoint.
http://play-demo-broker.cfapps.io/say?number=20
Which just return me number that have passed.
I am able successfully deploy the service. Next want this service to Act like service broker
For same want to register this as by using below command
cf create-service-broker play-demo-broker admin admin http://play-demo-broker.cfapps.io --space-scoped
This command it giving me below error -
The service broker rejected the request. Status Code: 404 Not Found
Not sure what is causing this issue as there not much information available for Play Framework Service broker Setup.
The play framework is implemented above the akka packages. Akka rejects paths that are not implemented.
If I an not mistaken, cf create-service-broker command access the / endpoint. If you implemented only say?number=20 endpoint, then be default all other paths, such as the empty path, are rejected by Akka.
In order to open that endpoint you need to add it into the routes.
For example you can add:
GET / controllers.ControllerName.GetEmptyPath
And implement the GetEmptyPath method in ControllerName
I am trying to see whether MarkLogic Java API can be used to create a content database and REST Server?
I went through te Java API but I dont see any reference.
Is it possible to create a REST Server through MarkLogic Java API?
I appreciate any links or pointers regarding this.
No, that's beyond the scope of the Java Client API. The Java Client API must connect to a REST Server after it's already created. You can, however, use the /rest-apis service on port 8002 via your favorite generic REST client API for Java. To see an example of how to do this with Apache HttpClient, see Bootstrapper.java. You can use it directly like the unit tests setup util TestServerBootstrapper.java does with this code:
Bootstrapper.main(new String[] {
"-configuser", username,
"-configpassword", password,
"-confighost", host,
"-restserver", "java-unittest",
"-restport", ""+port,
"-restdb", "java-unittest"});
I have to implement a simple client to a XDS.b server (SubmitObjectRequest and RetrieveDocumentSetRequest operations), but I'm struggling to get even a simple example of use to work.
I've tried using Mirth Connect's Channel for XDS.b also, but with no use. I even tried to copy its SOAP envelope to use with SoapUI. Didn't work.
I'm using HIEOS deployed on Glassfish as my XDS.b server.
I'm lost and confused. Could anyone give me a guidance on how to make this work?
If the HIEOS is deployed correctly within the Glassfish the service endpoint provides a wsdl definition where the interface is specified. Check the Glassfish for the wsdl of the service.
http://localhost:8080/my-ws/simple?WSDL
Quelle: docs.oracle.com/cd/E18930_01/html/821-2418/gbiyw.html
The list of provided endpoints you can see here:
https://kenai.com/projects/hieos/pages/WebServices
So to retrieve the wsdl you should use for example:
http://localhost:8080/axis2/services/xdsrepositoryb?wsdl
which applies for the ProvideAndRegisterDocumentSet-b transaction of the XDS Repository actor.
You can use the WSDL definition to create a WS request using SOAP UI at first.
SOAP UI creates a request based upon the wsdl definition which can be used to
test a against your XDS repo.
When you know how a SOAP request must be constructed you can try it using Mirth or
create your own client using Apache CXF http://cxf.apache.org/ for example.
Or you use AXIS2 to create a client from the WSDL. Of course does Visual Studio and C# also offer mechanisms to create a WS client directly from a WSDL definition.
I want to write a thrift service implementation in Scala (using Scrooge) but without the use of Finagle, since I couldn't write a ruby/python client for Finagle servers. The problem is that with scrooge the service doesn't seem to implement "Processor" class.
Assume I have a thrift definition like this:
service TestService {
void testFunction(1: string message);
}
and I generated the scala files using scrooge, when I tried to use the standard implementation of thrift for scala with that to run the server:
val st = new TServerSocket(9999)
val processor = new TestService.Processor(new TestServiceImpl)
val arg = new TThreadPoolServer.Args(st)
arg.processor(processor)
val server = new TThreadPoolServer(arg)
server.serve()
The generated TestService object doesn't seem to have the Processor inner class. Any idea how to do that without Finagle? or as another solution, how to write a python or ruby client to finagle thrift servers?
You must use the finagle thrift implementation with Scrooge. Note that it is all wire and IDL compatible, so you can use whatever implementations you want, given that you share the IDL.
You can write Ruby or Python clients for the finagle thrift service: it speaks the same protocol.
Based on the project you linked to, it appears that you have a transport mismatch between client and server.
Your python client is using the buffered transport:
transport = TTransport.TBufferedTransport(transport)
But your scala server is using the framed transport:
.codec(ThriftServerFramedCodec())
If you change the python client to use the framed transport, your issue should go away:
transport = TTransport.TFramedTransport(transport)
My problem has been solved by using the same transport in both python and scala.
in my python client.
transport = TTransport.TFramedTransport(transport)
You can find the sample working link
I am trying to get the response from a URI using httpclient and httpget. when i am trying to execute the httpclient.execute method it is giving me the http host connect exception. However when i am passing the same URI to the XML parsing code as inputstream the code works fine.
Does someone has any idea on the problem..
Help appreciated in advance
vaibhav
Are you behind a proxy? The HttpClient library probably uses a different way to configure the proxy than the XML library you are using. The following links may be useful, depending on the version of HttpClient you are using.
http://cephas.net/blog/2007/11/14/java-commons-http-client-and-http-proxies/ (pre 4.0)
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/200902.mbox/%3C499C63D1.1080701#apache.org%3E (4.0)