Unable to get Client Service to work

41 views
Skip to first unread message

Herbert Falk

unread,
Feb 21, 2021, 11:01:11 AM2/21/21
to Protocol Buffers
I have the following *.proto file:

package CredentialExchange;
option java_package = "pcitek.CredentialExchange";
option java_multiple_files = true;
option csharp_namespace = "pcitek.CredentialExchange";

import "uml.proto";

// The greeting service definition.
service CredExchangeSend {
  // Sends a Credential Exchange message
  rpc Cred (Management) returns (Management) ;
}

// MISSING DOCUMENTATION!!!
message sendCredentialsRequest
{
    // MISSING DOCUMENTATION!!!
    bytes encrypted = 1 [(uml.option_required_field) = true, (uml.option_multiplicity_min) = 1];
}

// MISSING DOCUMENTATION!!!
message Management
{
    option (uml.option_openfmb_profile) = true;
    // Version of the redundancy protocol
    uint32 version = 1 [(uml.option_required_field) = true, (uml.option_multiplicity_min) = 1];
    // Is a number that can be used to correlate request/responses
    uint32 messageID = 2 [(uml.option_required_field) = true, (uml.option_multiplicity_min) = 1];
    // Date and Time at which the message was started to be encoded.
    string utcTimeOfMessage = 3 [(uml.option_required_field) = true, (uml.option_multiplicity_min) = 1];
    // MISSING DOCUMENTATION!!!
    sendCredentialsRequest sendCredentialsRequest = 4;
}

I am trying to stage a Client Service for CredExchangeSend.

My current service declaration is:

        public  class CredentialExchangeService
        {
            public Task<pcitek.CredentialExchange.Management> rxd(
                pcitek.CredentialExchange.Management request)
            {
                PCItek.Redundancy.CredentialExInt.decode(request);
                return (null);
            }

        }

For the actual send, I need to pass in the actual Management class filled in.

This is what I am trying to do:


namespace pcitek.CredentialExchange
{
    public class sendCredentials
    {
        public async Task Send(pcitek.CredentialExchange.Management info)
        {

            string address = Redundancy.getRedundancyPeerAddress();
            using var channel = GrpcChannel.ForAddress(address+":5001");
            //

            var client = new pcitek.CredentialExchange.sendCredentials(channel)


            



        }
    }
}

The yellow'd statement fails because sendCredentials is not known.  Please note I also have: mapped a receiver service to: endpoints.MapGrpcService<PCItek.Redundancy.services.CredentialExchangeService>();

Any help would be appreciated.

Marc Gravell

unread,
Feb 21, 2021, 2:40:16 PM2/21/21
to Herbert Falk, Protocol Buffers
I'm a little confused here...

Normally, assuming that this is using the Google implementation, you would have, in your generated code:

- a generated concrete client proxy
- a generated abstract server stub
 
The client code would "new" the client proxy (the yellow code). Your server code would declare a type that subclasses the abstract stub, and register *that*. You wouldn't need to declare your own client/server core types. Have you perhaps simply not generated the right client/server stubs?


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/d9500f87-994e-49a7-a30f-658f77652109n%40googlegroups.com.

herbf...@gmail.com

unread,
Feb 21, 2021, 2:54:00 PM2/21/21
to Marc Gravell, Protocol Buffers

Marc,

 

I was just trying to make the following work: https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-5.0&tabs=visual-studio

 

See the GreeterClient section.

 

I will eventually have 3 high-level message types.  Both will be client/server in my ASP.Net Core implementation.

 

If you a pointer to how to do a concrete client for the class provided, that would be wonderful.

herbf...@gmail.com

unread,
Feb 21, 2021, 2:56:40 PM2/21/21
to Marc Gravell, Protocol Buffers

One last thing, there are encoders/decoders that were generated (maybe I didn’t use the correct / for protoc).  Attached is the c# file that was generated.

 

From: Marc Gravell <marc.g...@gmail.com>
Sent: Sunday, February 21, 2021 2:40 PM
To: Herbert Falk <herbf...@gmail.com>
Cc: Protocol Buffers <prot...@googlegroups.com>
Subject: Re: [protobuf] Unable to get Client Service to work

 

I'm a little confused here...

CredentialExchange.cs
Reply all
Reply to author
Forward
0 new messages