xsharp.eu • Write a web service - Page 2
Page 2 of 2

Write a web service

Posted: Thu Jun 13, 2019 6:25 am
by softdevo@tiscali.it
The reason is that I have to run complex code of my application and then return the result as an xml file.
So to summarize, if I understand correctly, the call to the web service takes place through the public method contained in the CLASS MathServices, which can return values of any type; and to return a file? it's possible? I imagine so.

thank you to all.

Danilo

Write a web service

Posted: Thu Jun 13, 2019 8:16 am
by wriedmann
Hi Danilo,

it is also possible to write an X# service and respond directly to the requests.

You can find a sample here:
https://www.riedmann.it/download/Vulcan ... ener.viaef

I'm using an application based on this sample for several years now on a customers server. The beauty of this solution is that you don't need anything special, as it does not needs any webserver, but uses http.sys that is part of every Windows installation.
The bad notice is that you have to do all by yourself - every input and output processing. This may be to much for a complex website, but is ok for a webservice, where the frontend could be built by a normal webserver.

Wolfgang

Write a web service

Posted: Thu Jun 13, 2019 8:21 am
by lumberjack
softdevo@tiscali.it wrote:The reason is that I have to run complex code of my application and then return the result as an xml file.
So to summarize, if I understand correctly, the call to the web service takes place through the public method contained in the CLASS MathServices, which can return values of any type; and to return a file? it's possible? I imagine so.
thank you to all.
Danilo, am I correct in assuming you have a desktop client that you want to interface to a webservice?
In that case google WSDL, you will find how to create a "local" client for the webservice that you link into your application which will have all the interfaces to communicate with the webservice, no worry about having to convert to xml etc.

Attached a class that I wrote in the Vulcan days to create a c# assembly that you can then use to communicate with the webservice.

Hope this helps.
jhnWSDL.zip
(2.2 KiB) Downloaded 100 times

Write a web service

Posted: Thu Jun 13, 2019 9:31 am
by softdevo@tiscali.it
Thank you Wolfgang, Precious as usual

Danilo

Write a web service

Posted: Thu Jun 13, 2019 9:35 am
by softdevo@tiscali.it
I have to provide information processed by my web application, written in XSharp, to an app that will run on an Android or Apple smartphone

Danilo

Write a web service

Posted: Thu Jun 13, 2019 10:07 am
by lumberjack
softdevo@tiscali.it wrote:I have to provide information processed by my web application, written in XSharp, to an app that will run on an Android or Apple smartphone
The only thing you have to do is to [WebMethod] what you want exposed with a return type, the web server (IIS, Apache) will handle the rest of converting to xml and pass to the client.

Write a web service

Posted: Thu Jun 13, 2019 8:18 pm
by Jamal
Hi Johan,

To be able the access the web service, CORS has to be setup properly in the Global.asax file and the a Public Interface has to be created as [ServiceContract] and each method has to be declared, but then I found WCF generation in X# is not correct (it's generating X# and C# code!!). Please see my other post (WCF generation incorrect). Also, It seems now there is no X# template to create a web application, so WCF in X# right may not be ready. I did not see it in the 2019 Road Map.

Jamal