WCF generation incorrect

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

WCF generation incorrect

Post by Jamal »

It seems the WCF generation code is incomplete. It is creating X# code in Service.prg and C# code in IService1.prg which leads to compile errors.

To replicate, Add WCF to project.

Service1.prg:

Code: Select all

using System
using System.Collections.Generic
using System.Runtime.Serialization
using System.ServiceModel
using System.Text

BEGIN NAMESPACE  xSharpWinFormsApp1

	CLASS Service1 IMPLEMENTS $contractName$
		METHOD DoWork() as VOID STRICT
			RETURN

	END CLASS
END NAMESPACE
IService.prg has C# code:

Code: Select all

using System
using System.Collections.Generic
using System.Runtime.Serialization
using System.ServiceModel
using System.Text

namespace xSharpWinFormsApp1
{
	[ServiceContract]
	public interface IService1
	{
		[OperationContract]
		void DoWork()
	}
}


Also to be able to call a WCF web service from a web application, a X# web application template must be available and which creates a Global.asx.prg to properly setup CORS properties.

Jamal
NickFriend
Posts: 248
Joined: Fri Oct 14, 2016 7:09 am

WCF generation incorrect

Post by NickFriend »

Hi Jamal,

I think that in reality none of the templates or service references as provided in C# are really necessary. We've been working for years without this, simply coding the WCF channels directly in the client app (it's a few dozen lines of pretty generic code).

At the service end it's as you say, simply a matter of decorating the service methods with ServiceContract and OperationContract. That and a one line svc file and some declarations in web.config, then host in IIS.

I can share any (C#) code if it would be of help.

Nick
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

WCF generation incorrect

Post by Jamal »

Hi Nick,

I have no issues doing this in C# as I've been for years publishing or consuming web services in various flavors.
The point here is X# WCF generation is incorrect; just helping in any way to report such issues to the dev team.

Jamal
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

WCF generation incorrect

Post by Chris »

Hi Jamal,
Jamal wrote:It seems the WCF generation code is incomplete. It is creating X# code in Service.prg and C# code in IService1.prg which leads to compile errors.
Oops! :)
Confirmed of course, thanks!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
NickFriend
Posts: 248
Joined: Fri Oct 14, 2016 7:09 am

WCF generation incorrect

Post by NickFriend »

Ah ok... just thought it was giving you problems as well.

Nick
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

WCF generation incorrect

Post by ic2 »

Hello Jamal,

A few years ago I created the code for X# mainly from Nick's Devshare C# notes; I had to solve quite a couple of problems with code where I hardly understand what it is supposed to do. The most difficult one was actually solved by Nick who checked what happened on the website where I wanted to exchange code with and I ended up with a reliable WCF interface with an X# client and a C# DLL on the website as server.

I am unaware of X# WCF code generation but if you need working code I can send you that.

Dick
Post Reply