Hey everyone,
I’m working on a project where we need to create a C# user interface for our internal web apps. These apps are built with PHP and Python, running on Apache. We’re doing this because sometimes a native Windows interface can be more efficient than a web browser for our specific needs.
My main concern is how to set up communication between C# and PHP/Python using HTTPS. I’m particularly interested in how to handle data serialization and type conversion between these languages.
Ideally, we want to use strongly typed structs or objects in C# and matching data structures in PHP/Python. We’re open to using code generators if needed.
I’ve looked into a few options like Apache Thrift and Google’s Protocol Buffers, but I’m not sure which way to go. Thrift seems promising, but the docs are pretty thin.
Our main priorities are:
- Keeping it simple for our developers
- Maintaining good performance, especially on the server side
Anyone have experience with XMLRPC, SOAP, or other similar tech for this kind of setup? Any advice would be super helpful!
Thanks in advance!
have u considered using REST APIs? They’re pretty straightforward and work well with C#, PHP, and Python. you could serialize data as JSON, which is easy to handle in all three languages. For type conversion, you might wanna look into libraries like Newtonsoft.Json for C#. what kinda data are you dealing with? that could help narrow down the best approach
hey, just a thought - have u tried gRPC? it’s pretty solid for cross-language communication. supports strong typing n code generation. plus it’s faster than REST for high-traffic scenarios. might be worth checkin out, especially if ur dealing with complex data structures. just my 2 cents!
From my experience, GraphQL could be an excellent solution for your situation. It allows for strongly typed schemas that can be shared between your C# frontend and PHP/Python backend. This approach provides type safety and enables automatic code generation on both ends.
GraphQL’s flexibility in querying only the needed data can significantly improve performance, especially on the server side. It also handles data serialization seamlessly.
For implementation, you could use libraries like GraphQL.NET for C#, and Graphene for Python or webonyx/graphql-php for PHP. These libraries make it relatively straightforward to set up and maintain.
While there might be a slight learning curve, the long-term benefits in terms of developer productivity and system performance could outweigh the initial investment. It’s worth exploring as a robust alternative to the options you’ve mentioned.