Best method for C# frontend to communicate with Apache/PHP/Python backend

Need help connecting C# GUI to web backend

I’m working on a project where we want to create a Windows app using C# that talks to our web apps. These web apps run on Apache and use PHP or Python.

We’re doing this for internal use because a native Windows interface can be more user-friendly than a web browser sometimes.

I’m trying to figure out the best way for the C# part to talk to the PHP/Python part over HTTPS. The tricky part is dealing with different data types in each language.

Ideally, we want to use strong typing in C# and have matching data structures on the PHP/Python side. We’re okay with using code generators if needed.

I’ve looked at a few options like Apache Thrift and Google’s Protocol Buffers. Thrift seems good but doesn’t have much documentation.

Our main priorities are:

  1. Making it easy for developers to use
  2. Keeping the server performance decent

Has anyone tried XMLRPC or SOAP for this kind of thing? Any other ideas?

Thanks for any advice!

hey there, another option to consider is grpc. it’s pretty fast and supports strong typing. u can define ur data structures in .proto files and generate code for both c# and python. it handles serialization and deserialization for ya too. might be worth checking out if performance is important!

I’ve had success using GraphQL for similar scenarios. It offers strong typing and allows you to define a schema that both your C# client and PHP/Python server can understand. You can use libraries like GraphQL.NET on the C# side and Graphene for Python or webonyx/graphql-php for PHP.

GraphQL gives you flexibility in querying only the data you need, which can help with performance. It also handles different data types well across languages. You can use code generation tools to create type-safe client code in C# based on your schema.

One caveat is that it might have a steeper learning curve compared to REST APIs. However, the benefits in terms of type safety and query flexibility could outweigh this, especially for internal applications where you control both ends.

have u considered using rest apis with json? it’s simple and works accross various languages. you can try libraries like restsharp in c# for making http requests and parsing responses. what type of data do u plan to exchange? would love to hear mor details.