GoLang wrapper for EWS / ExchangeService - c#

I have some C# code that uses the ExchangeService (via Microsoft.Exchange.WebServices.dll) object to do some typical email tasks (e.g. fetch email, send email). I'd like to be able to do the same thing, but using Go instead of C#. What is the most direct way to do this? I understand there are tools such as CGo but given that this is MSFT-provided DLL that is part of the .NET framework, I suspect the process is not as simple as it would be if I were creating my own DLL.

You have to roll your own SOAP requests to EWS. The managed/.NET EWS API is just a nicely packaged set of SOAP requests.

You can only use the managed .dll with a .NET language, i.e., C#, PowerShell, etc. If you are not going to use a .NET language then you have to construct your own SOAP requests for EWS to consume.
FYI, if this is an Exchange 2016 environment you might want to look into the Exchange REST API which is language agnostic.

I am working on https://github.com/mhewedy/ews can be a good start.

Related

Solace JNDI/JMS Syntax for C# .NET

A vendor is using Solace to send messages. I have obtained a SubscriptionId using web service call, that I supposed to be submitted to the Solace server.
Using the documentation and sample code at dev.solace.com, I have been able to connect a session. However, I am lost as to how to go to the next step which is to subscribe to what I believe is a queue using a connection factory, jndi factory an jms destination name.
The sample shows this:
Session.Connect(ContextFactory.Instance.CreateQueue(Topic), true);
But from what I can tell, that won't work as the vendor wants jndi/jms, and the Solace documentation has no .NET code for jndi/jms, which leaves me guessing.
Help!
Please use the JMS API instead of the .NET API in order to perform JMS.
The .NET API does not do JMS.
Note that you can send/receive messages using the .NET API that's inter-operable with the JMS API.
However, since you have a hard requirement to use JMS, your only option is to use the JMS API.
As It turns out, the jndi/jms information delivered by the host for configuration was unneeded. What was necessary was to connect to the queue and receive the messages.

facebook like chat application in ASP.net

I want to build web based facebook like lightweight chat for my site.
Website build on ASP .net on SQL server 2005.
I am interesetd in XMPP commmunication, but not able to find open source XMPP server with supportedlibrary for C# so that I can create client for my site.
Have checked googling butno luck for C# library; all I could found is plugin and jar.
Is it possible to implement chat logic and XMPP server communication in different language, and accessing thisdata through iframe or by other means on my site.
Thanks,
Hitesh.
http://www.ag-software.de/agsxmpp-sdk/
That library seems to be pretty good.
What you'll want to do is follow jgauffin's suggestion, and use an XMPP library on the backend, and then typically you'd add in a comet server for integration with your web frontend (we've actually done exactly this # Frozen Mountain, using WebSync).
If you're building a smaller site and/or don't need the "realtime" aspect, you could probably get away with polling as well, in which case you'd need to store the results from the XMPP library in your own system, and poll that (since XMPP is strictly event driven).
There are many options to send a message since first human! But how about the intelligence on it, automated collaboration in object level or shared objects among the users etc. I suggest you to take a look for the samples in here and feel the difference.

Can I interact with .NET libraries through Javascript?

We've built a set of .NET libraries (in C#) which are used to interact with an outside resource. The outside resource provide bindings in Java and .NET, so it was necessary to build our libraries in one of those languages and we're officially a Windows shop.
We also use PHP/Javascript for a lot of our front-end web applications. Is it possible for these PHP/Javascript web applications to interact with our .NET libraries? We have both IIS and Apache web servers if that makes a difference. Communication would need to go in both directions.
The most obvious approach is exposing your .NET libraries as web services on a web server (either IIS or Apache/Mono). This allows both JS and PHP to consume the same service endpoints (JS via AJAX, PHP vs web service calls).
If extreme performance is a concern - for example, your PHP apps need to make heavy calls into the .NET libraries as if they are native, then web services are probably not the best approach. For that, you might want to look into making COM Callable Wrappers for your .NET libraries and consuming them from PHP.
Although Ajax is the usual approach, another idea for you, in case it might help, would be to use Silverlight on the client side. That way, you would embed your .NET classes into a Silverlight application, which would then be downloaded to the client where it would run inside the browser. Silverlight apps can easily interact bi-directionaly with JavaScript, as well as with remote resources.
For example, you can mark a .NET method with the [ScriptableMember] attribute, which will expose it to JavaScript.
You can pass data via AJAX calls where you communicate to and from the client via JSON. For client side data set manipulation jLinq is a great library for performing Linq queries on JSON objects.
If you are looking for a good place to start with web services, JSON and ASP.Net webforms Dave Ward's posts on Encosia are really top notch.

How to implement SOAP?

I have to implement SOAP via HTTP, using C#.
Do you know any good documents, and sample code to help?
Most probably you won't need to handle the actual SOAP protocol. If you have access to the WSDL document, Visual Studio will automatically build a proxy for your SOAP web service.
After that, you simply access the generated object's members as if it were a local object.
Check this link for an example.
If you're on .NET 3.0 or higher: use WCF - it's the most current, most flexible way to implement SOAP communication.
See the WCF developer center here on MSDN: http://msdn.microsoft.com/en-us/netframework/aa663324.aspx
WCF gives you plenty of options how to send messages to a remote system - be it HTTP or TCP/IP or MSMQ - you got the choice.
Marc
Thanks to google, I have found the following:
http://www.w3schools.com/SOAP/soap_intro.asp - Some background
http://www.w3schools.com/soap/default.asp - Tutorials

C# & PHP: Simple example of PHP Web Service used by C#

Could anyone give me a small and simple example of how to do this? Or some good pointers on how to get started.
I would like to create a C# client that can send a file or some text or xml or whatever, to a web service or something similar written in PHP, where the PHP Web Service stores it in a file or a database or something like that. Just not sure how to get started.
I guess the first step would be to create the php web service. And then it perhaps would be quite easy to use it in C#, since I could probably pretty much use the "Add Web Reference" button in vs and then go from there?
You can take a look at this tutorial showing how to develop a web service using php. The .NET client will be pretty straightforward as you mentioned.
I'm not versed in the C# aspect of your question, which you intend to be the consumer. But if you don't mind using a library to expedite the process of getting the webservice up and running, you can set one up very quickly using Zend Framework. Check out the documentation for setting up a Zend_Rest_Server.
Just a thought... if the service only has to support simple operations like "upload a file", perhaps avoid WSDL all together? I assume PHP can handle raw requests - so you can use the oh-so-complex .NET client:
using (WebClient client = new WebClient())
{
client.UploadFile("http://some/upload.php", "foo.bar");
client.UploadString("http://some/upload.php", "some text");
}
etc. Likewise, you can often easily use POX / REST without the complexity of a formal web-service contract. The above code just does a simple HTTP request with the file-contents/string in the body.
you are right. all you need to do is to create a simple web service in PHP, which accepts the request/xml/file and then stores it in a database. then you can use the webservice using any technology, C# for sure.
in order to write a web service in PHP, I think it is better to choose your webservice type in the first step. it can be a REST web service, or SOAP, or XML-RPC. it depends on the level of complexity of your application.
if your application is as simple as just throwing a string to the webservice or a file URL, so then the webservice can store that string, or fetch the file from the URL and stores it in database, I recomment REST. because it is simpler. as simple as just writing a simple PHP script that uses it's HTTP parameters as input.
but incase you want it to be more secure or have more complex needs, It is easy to have SOAP services in PHP. if you wanted to work with SOAP, PHP has an extension (php-soap) which you can install and use the built-in functionality of PHP-SOAP. if you are using an older version of PHP that does not support the extension, or your application will be hosted where php-soap is not installed, there is pure PHP implementaion of SOAP protocol, named nusoap. it is open source and works very well.
http://sourceforge.net/projects/nusoap/
I have made work in PHP NuSOAP webservice and my C# mobile client fetching data from web services.Below is the link
http://khanmubeen.wordpress.com/2010/11/18/web-services-with-php-nusoap-c-mobile-client/
In case you like to know more from me welcome to inbox me at mubeen44us at gmail.com

Categories