🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.delphi.dotnet
7 messages
7 total messages Started by StigP Fri, 06 Jun 2008 12:27
WCF RESTful web services
#140
Author: StigP
Date: Fri, 06 Jun 2008 12:27
153 lines
4557 bytes
I am playing with WCF and tried to follow the excellent blog from Pawel 
Glowacki http://blogs.codegear.com/pawelglowacki/2008/04/04/38508 
(Building .NET 3.5 WCF RESTful web services with Delphi 2007)

However I cannot get D2007, with all the latest updates, to compile the 
example. The error I get is:
[DCC Error] F2084 Internal Error: G3957
[DCC Error] E2202 Required package 'System.ServiceModel.Web' not found

But in 'References' I have:
System.Runtime.Serialization.dll
System.ServiceModel.dll
System.ServiceModel.Web.dll

However, implementing the same litle example in C#-Visual Studio Express 
compiles straight away.

Any ideas?

Thanks
/Stig


Delphi code is:

program RestfullServer;
{$APPTYPE CONSOLE}

uses
   System.ServiceModel,
   System.ServiceModel.Web;

type
   [ServiceContract]
   ICalcService = interface
     [OperationContract]
     [WebGet(UriTemplate='Add?a={x}&b={y}')]
     function Add(x, y: integer): integer;

     [OperationContract]
     [WebGet(UriTemplate='Sub?a={x}&b={y}', 
ResponseFormat=WebMessageFormat.Json)]
     function Sub(x, y: integer): integer;
   end;

   TCalcService = class(TObject, ICalcService)
   public
     function Add(x, y: integer): integer;
     function Sub(x, y: integer): integer;
   end;

{ TService }
function TCalcService.Add(x, y: integer): integer;
begin
   Result := x + y;
end;

function TCalcService.Sub(x, y: integer): integer;
begin
   Result := x - y;
end;


{ MAIN }
var
   aBaseAddress: string;
   URIs: array of Uri;
   host: WebServiceHost;
begin
   aBaseAddress := 'http://localhost:8000/';
   SetLength(URIs, 1);
   URIs[0] := Uri.Create(aBaseAddress);

   host := WebServiceHost.Create(typeof(TCalcService), URIs);
   try

     host.Open;

     WriteLn('Service is running and listening at ' + aBaseAddress);
     WriteLn('Press any key to quit...');
     ReadLn;

     host.Close;

   except
     on e: Exception do
     begin
       host.Abort;
       WriteLn(e.Classname, ': ', e.Message);
       ReadLn;
     end;
   end;
end.


// ============================================================

C# code is:
using System;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace WCF35_Restful_Calculator {

     [ServiceContract]
     interface ICalcService {
         [OperationContract,
         WebGet(UriTemplate = "Add?a={x}&b={y}")]
         int Add(int x, int y);

         [OperationContract,
         WebGet(UriTemplate = "Sub?a={x}&b={y}", ResponseFormat = 
WebMessageFormat.Json)]
         int Sub(int x, int y);
     }

     class CalcService : Object, ICalcService {
         public int Add(int x, int y) {
             return x + y;
         }

         public int Sub(int x, int y) {
             return x - y;
         }
     }

     class Program {
         static void Main(string[] args) {
             string baseAddress = "http://localhost:8000/";
             Uri[] URIs = new Uri[1] { new Uri(baseAddress) };

             WebServiceHost host = new 
WebServiceHost(typeof(CalcService), URIs);
             try {
                 host.Open();

                 Console.WriteLine("Service is running and listening at 
" + baseAddress);
                 Console.WriteLine("Press any key to quit...");
                 Console.ReadLine();

                 host.Close();

             }
             catch (Exception e) {
                 host.Abort();
                 Console.WriteLine(e.GetType().ToString() + " : " + 
e.Message);
                 Console.ReadLine();
             }
         }
     }
}
Re: WCF RESTful web services
#143
Author: John Moshakis
Date: Fri, 06 Jun 2008 14:59
33 lines
1599 bytes
StigP wrote:

> I am playing with WCF and tried to follow the excellent blog from
> Pawel Glowacki
> http://blogs.codegear.com/pawelglowacki/2008/04/04/38508 (Building
> .NET 3.5 WCF RESTful web services with Delphi 2007)
> 
> However I cannot get D2007, with all the latest updates, to compile
> the example. The error I get is:  [DCC Error] F2084 Internal Error:
> G3957 [DCC Error] E2202 Required package 'System.ServiceModel.Web'
> not found
> 
> But in 'References' I have:
> System.Runtime.Serialization.dll
> System.ServiceModel.dll
> System.ServiceModel.Web.dll
> 
> However, implementing the same litle example in C#-Visual Studio
> Express compiles straight away.
> 
> Any ideas?
> 

Hi StigP,

Is your search path the same ?



Cheers,
John

-- 
Re: WCF RESTful web services
#149
Author: StigP
Date: Mon, 09 Jun 2008 09:33
44 lines
2125 bytes
Yes!

And even if I try a completely empty Console .net app, with the same 
references - I get a similar error. This time it's missing the 
Serilization pagckage...

Actually, this happens on two different computers! And they have all 
WindowsXP updates and all D2007-Architect updates!

/Stig

John Moshakis skrev:
> StigP wrote:
> 
>> I am playing with WCF and tried to follow the excellent blog from
>> Pawel Glowacki
>> http://blogs.codegear.com/pawelglowacki/2008/04/04/38508 (Building
>> .NET 3.5 WCF RESTful web services with Delphi 2007)
>>
>> However I cannot get D2007, with all the latest updates, to compile
>> the example. The error I get is:  [DCC Error] F2084 Internal Error:
>> G3957 [DCC Error] E2202 Required package 'System.ServiceModel.Web'
>> not found
>>
>> But in 'References' I have:
>> System.Runtime.Serialization.dll
>> System.ServiceModel.dll
>> System.ServiceModel.Web.dll
>>
>> However, implementing the same litle example in C#-Visual Studio
>> Express compiles straight away.
>>
>> Any ideas?
>>
> 
> Hi StigP,
> 
> Is your search path the same ?
> 
> 
> 
> Cheers,
> John
> 
Re: WCF RESTful web services
#150
Author: John Moshakis
Date: Mon, 09 Jun 2008 14:58
22 lines
1517 bytes
StigP wrote:

> Yes!
> 
> And even if I try a completely empty Console .net app, with the same
> references - I get a similar error. This time it's missing the
> Serilization pagckage...
> 
> Actually, this happens on two different computers! And they have all
> WindowsXP updates and all D2007-Architect updates!
> 

When I initially repeated the steps in the article it worked.
Unfortunately when I reopened the project I got the error.

I have no idea why it would stop working.

Cheers,
John

-- 
Blog: http://blog.moshine.com/
Re: WCF RESTful web services
#1
Author: StigP
Date: Mon, 09 Jun 2008 18:44
32 lines
1841 bytes
Thanks anyway,

Maybe the latest D2007 upgrade/service-pack broke something!
I did'nt try before.

I'll see if I can get it into QC!

Regards
/Stig


John Moshakis wrote:
> StigP wrote:
> 
>> Yes!
>>
>> And even if I try a completely empty Console .net app, with the same
>> references - I get a similar error. This time it's missing the
>> Serilization pagckage...
>>
>> Actually, this happens on two different computers! And they have all
>> WindowsXP updates and all D2007-Architect updates!
>>
> 
> When I initially repeated the steps in the article it worked.
> Unfortunately when I reopened the project I got the error.
> 
> I have no idea why it would stop working.
> 
> Cheers,
> John
> 
Re: WCF RESTful web services
#32
Author: Ralf Grenzing
Date: Tue, 17 Jun 2008 18:38
25 lines
1877 bytes
StigP schrieb:
> Thanks anyway,
> 
> Maybe the latest D2007 upgrade/service-pack broke something!
> I did'nt try before.
> 
> I'll see if I can get it into QC!
> 

Hi,

for everyone who has the same problem, please put your votes on this QC 
issue: http://qc.borland.com/wc/qcmain.aspx?d=63030

I managed to reproduce the problem with a small batch file which calls 
the dccil.exe. I posted it to binary group.

Is there a change that this issue can solved fast? AFAIKS it would be 
enough to post the generated dcpil to the binary group. Then everyone 
just need to reference them and the compiler did not need to generate 
them again.

best regards

Ralf Grenzing - OPUS//G
Re: WCF RESTful web services
#33
Author: StigP
Date: Wed, 18 Jun 2008 08:09
37 lines
2235 bytes
Hi Ralf,

Actually I think the REAL problem is that the Delphi.NET compiler 
does'nt search the GAC for assemblies - as it should!
I can see no good reason for setting the search-path to include 
C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation 
when the needed assemblies are in the GAC!

Regards
/Stig

Ralf Grenzing wrote:
> StigP schrieb:
>> Thanks anyway,
>>
>> Maybe the latest D2007 upgrade/service-pack broke something!
>> I did'nt try before.
>>
>> I'll see if I can get it into QC!
>>
> 
> Hi,
> 
> for everyone who has the same problem, please put your votes on this QC 
> issue: http://qc.borland.com/wc/qcmain.aspx?d=63030
> 
> I managed to reproduce the problem with a small batch file which calls 
> the dccil.exe. I posted it to binary group.
> 
> Is there a change that this issue can solved fast? AFAIKS it would be 
> enough to post the generated dcpil to the binary group. Then everyone 
> just need to reference them and the compiler did not need to generate 
> them again.
> 
> best regards
> 
> Ralf Grenzing - OPUS//G
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads