Has anyone written a web service with XSharp? any ideas / suggestions / examples?
Thank you all
Danilo
Write a web service
Write a web service
Hi Danilo,
I might not be right, but I have not seen a way to design web services in X#.
I expected that X# may compile the following code, but it errors on [WebMethod].
Dev team, any comment?
Furthermore, you cannot "Add Service Reference" to a program References like C#.
Jamal
I might not be right, but I have not seen a way to design web services in X#.
I expected that X# may compile the following code, but it errors on [WebMethod].
Dev team, any comment?
Code: Select all
CLASS MathServices
CONSTRUCTOR()
RETURN
[WebMethod]
public function Add(a as int, b as int) as int
return(a + b)
END CLASS
Jamal
- softdevo@tiscali.it
- Posts: 191
- Joined: Wed Sep 30, 2015 1:30 pm
Write a web service
For greater clarity.
I must be able to ask a web server for information such as the values contained in a database table or for example to receive in XML format the result of a processing performed on the web server.
Danilo
I must be able to ask a web server for information such as the values contained in a database table or for example to receive in XML format the result of a processing performed on the web server.
Danilo
Write a web service
Jamal,
There is a semi colon missing after the attribute, and you should name it Method in stead of Function
Robert
There is a semi colon missing after the attribute, and you should name it Method in stead of Function
Code: Select all
[WebMethod];
public method Add(a as int, b as int) as int
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Write a web service
Robert,
Thanks, I modified the code and added some comments.
And here is how it is called:
Jamal
Thanks, I modified the code and added some comments.
Code: Select all
USING System
USING System.Collections.Generic
USING System.Text
using System.Web.Services // need this reference
BEGIN NAMESPACE xSharpWinFormsApp1
CLASS MathServices
CONSTRUCTOR()
RETURN
[WebMethod]; // semi colon needed (strange X# requirement)
public method Add(a as int, b as int) as int
return(a + b)
END CLASS
END NAMESPACE
Code: Select all
LOCAL ws := MathServices{} as MathServices
MessageBox.Show(ws:Add(1,2).ToString()) // result 3
Write a web service
I think you are talking about consuming a web service and generating class via the Add Service Reference.
Robert, why is it missing and is there a plan to implement it (C# screenshot below)?
Robert, why is it missing and is there a plan to implement it (C# screenshot below)?
Write a web service
Jamal,
The semi colon is needed because the CRLF after [WebMethod] is a statement delimiter. By adding the semi colon the attribute belongs to the following line.
You can also write
[WebMethod] public method Add()
Robert
The semi colon is needed because the CRLF after [WebMethod] is a statement delimiter. By adding the semi colon the attribute belongs to the following line.
You can also write
[WebMethod] public method Add()
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Write a web service
Jamal,
I will see of I can add this (Add Service Reference) in the X# project system.
Robert
I will see of I can add this (Add Service Reference) in the X# project system.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 248
- Joined: Fri Oct 14, 2016 7:09 am
Write a web service
Hi Danilo,
I haven't done it with X#, but with C# we use web services running under WCF. This works very well, and I can't see any reason why it couldn't be done with X#. Stuff like serialisation of data transmitted is all handled automatically, so once you've got it up and running it's very easy to use.
Nick
I haven't done it with X#, but with C# we use web services running under WCF. This works very well, and I can't see any reason why it couldn't be done with X#. Stuff like serialisation of data transmitted is all handled automatically, so once you've got it up and running it's very easy to use.
Nick
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Write a web service
Hi Nick/Danilo
I have never done a X# web service directly, but have done web services with a c# wrapper that actually have X# code behind. No problem in consuming web services from a X# application, even through dynamic HttpRe<classname> calls. Cannot comment about aspx web front-ends though... But the back-end can be X#.NickFriend wrote:Hi Danilo,
I haven't done it with X#, but with C# we use web services running under WCF. This works very well, and I can't see any reason why it couldn't be done with X#. Stuff like serialisation of data transmitted is all handled automatically, so once you've got it up and running it's very easy to use.
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa