diff --git a/wst/trunk/samples/widestring/client/echo_service.pas b/wst/trunk/samples/widestring/client/echo_service.pas
new file mode 100644
index 000000000..f5d324562
--- /dev/null
+++ b/wst/trunk/samples/widestring/client/echo_service.pas
@@ -0,0 +1,78 @@
+{
+This unit has been produced by ws_helper.
+ Input unit name : "echo_service".
+ This unit name : "echo_service".
+ Date : "06/04/2009 17:57:59".
+}
+unit echo_service;
+{$IFDEF FPC}
+ {$mode objfpc} {$H+}
+{$ENDIF}
+{$IFNDEF FPC}
+ {$DEFINE WST_RECORD_RTTI}
+{$ENDIF}
+interface
+
+uses SysUtils, Classes, TypInfo, base_service_intf, service_intf;
+
+const
+ sNAME_SPACE = 'uri:echo-service';
+ sUNIT_NAME = 'echo_service';
+
+type
+
+
+ IEchoService = interface(IInvokable)
+ ['{FCD0F68F-3023-46C6-AD09-1DDA4A2989EB}']
+ function EchoWideString(
+ const AValue : WideString
+ ):WideString;
+ end;
+
+ procedure Register_echo_service_ServiceMetadata();
+
+Implementation
+uses metadata_repository, record_rtti, wst_types;
+
+
+procedure Register_echo_service_ServiceMetadata();
+var
+ mm : IModuleMetadataMngr;
+begin
+ mm := GetModuleMetadataMngr();
+ mm.SetRepositoryNameSpace(sUNIT_NAME, sNAME_SPACE);
+ mm.SetServiceCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'FORMAT_Style',
+ 'rpc'
+ );
+ mm.SetOperationCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'EchoWideString',
+ '_E_N_',
+ 'EchoWideString'
+ );
+ mm.SetOperationCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'EchoWideString',
+ 'FORMAT_Input_EncodingStyle',
+ 'literal'
+ );
+ mm.SetOperationCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'EchoWideString',
+ 'FORMAT_OutputEncodingStyle',
+ 'literal'
+ );
+end;
+
+
+initialization
+
+
+
+End.
diff --git a/wst/trunk/samples/widestring/client/echo_service.wst b/wst/trunk/samples/widestring/client/echo_service.wst
new file mode 100644
index 000000000..8e1db261d
--- /dev/null
+++ b/wst/trunk/samples/widestring/client/echo_service.wst
@@ -0,0 +1,5 @@
+ GetWSTResourceManager().AddResource('ECHO_SERVICE',
+ #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#12'echo_service'#1#0#0#0#12'IEchoServi'
+ +'ce'#1#0#0#0#14'EchoWideString'#2#0#0#0#6'AValue'#0#0#0#10'WideString'#0#0#0
+ +#0#0#0#0#1#0#0#0#6'Result'#0#0#0#10'WideString'#0#0#0#0#0#0#0#3''
+ );
\ No newline at end of file
diff --git a/wst/trunk/samples/widestring/client/echo_service_proxy.pas b/wst/trunk/samples/widestring/client/echo_service_proxy.pas
new file mode 100644
index 000000000..4bfe75f86
--- /dev/null
+++ b/wst/trunk/samples/widestring/client/echo_service_proxy.pas
@@ -0,0 +1,81 @@
+{
+This unit has been produced by ws_helper.
+ Input unit name : "echo_service".
+ This unit name : "echo_service_proxy".
+ Date : "06/04/2009 17:57:59".
+}
+
+Unit echo_service_proxy;
+{$IFDEF FPC} {$mode objfpc}{$H+} {$ENDIF}
+Interface
+
+Uses SysUtils, Classes, TypInfo, base_service_intf, service_intf, echo_service;
+
+Type
+
+
+ TEchoService_Proxy=class(TBaseProxy,IEchoService)
+ Protected
+ class function GetServiceType() : PTypeInfo;override;
+ function EchoWideString(
+ const AValue : WideString
+ ):WideString;
+ End;
+
+ Function wst_CreateInstance_IEchoService(const AFormat : string = 'SOAP:'; const ATransport : string = 'HTTP:'; const AAddress : string = ''):IEchoService;
+
+Implementation
+uses wst_resources_imp, metadata_repository;
+
+
+Function wst_CreateInstance_IEchoService(const AFormat : string; const ATransport : string; const AAddress : string):IEchoService;
+Var
+ locAdr : string;
+Begin
+ locAdr := AAddress;
+ if ( locAdr = '' ) then
+ locAdr := GetServiceDefaultAddress(TypeInfo(IEchoService));
+ Result := TEchoService_Proxy.Create('IEchoService',AFormat+GetServiceDefaultFormatProperties(TypeInfo(IEchoService)),ATransport + 'address=' + locAdr);
+End;
+
+{ TEchoService_Proxy implementation }
+
+class function TEchoService_Proxy.GetServiceType() : PTypeInfo;
+begin
+ result := TypeInfo(IEchoService);
+end;
+
+function TEchoService_Proxy.EchoWideString(
+ const AValue : WideString
+):WideString;
+Var
+ locSerializer : IFormatterClient;
+ locCallContext : ICallContext;
+ locStrPrmName : string;
+Begin
+ locCallContext := Self as ICallContext;
+ locSerializer := GetSerializer();
+ Try
+ locSerializer.BeginCall('EchoWideString', GetTarget(),locCallContext);
+ locSerializer.Put('AValue', TypeInfo(WideString), AValue);
+ locSerializer.EndCall();
+
+ MakeCall();
+
+ locSerializer.BeginCallRead(locCallContext);
+ locStrPrmName := 'result';
+ locSerializer.Get(TypeInfo(WideString), locStrPrmName, Result);
+
+ Finally
+ locSerializer.Clear();
+ End;
+End;
+
+
+initialization
+ {$i echo_service.wst}
+
+ {$IF DECLARED(Register_echo_service_ServiceMetadata)}
+ Register_echo_service_ServiceMetadata();
+ {$IFEND}
+End.
diff --git a/wst/trunk/samples/widestring/client/ws_client.lpi b/wst/trunk/samples/widestring/client/ws_client.lpi
new file mode 100644
index 000000000..278e0530f
--- /dev/null
+++ b/wst/trunk/samples/widestring/client/ws_client.lpi
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wst/trunk/samples/widestring/client/ws_client.pas b/wst/trunk/samples/widestring/client/ws_client.pas
new file mode 100644
index 000000000..86d5987f9
--- /dev/null
+++ b/wst/trunk/samples/widestring/client/ws_client.pas
@@ -0,0 +1,48 @@
+program ws_client;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}
+ cthreads, cwstring,
+ {$ENDIF}
+ Classes, SysUtils,
+ service_intf, soap_formatter, synapse_http_protocol,
+ echo_service, echo_service_proxy;
+
+const
+ utf16_bom : array[0..1] of Byte = ($FF, $FE);
+ binary_buffer : array[0..7] of Word = ($E9, $E9, $E8, $E8, $E7, $E7, $E0, $E0);
+
+var
+ locService : IEchoService;
+ ws, wsres : WideString;
+ ms : TMemoryStream;
+ c : Integer;
+begin
+ SYNAPSE_RegisterHTTP_Transport();
+
+ locService := wst_CreateInstance_IEchoService('SOAP:','HTTP:','http://127.0.0.1:8000/services/IEchoService');
+
+ WriteLn('WST WideString Sample - Client');
+
+ ms := TMemoryStream.Create();
+ try
+ SetLength(ws, Length(binary_buffer) );
+ Move(binary_buffer[0], Pointer(ws)^, Length(binary_buffer) * 2);
+
+
+ ms.Write(utf16_bom,SizeOf(utf16_bom));
+ ms.Write(Pointer(ws)^, ( Length(ws) * SizeOf(WideChar) ) );
+ ms.SaveToFile(ExpandFileName('.' + PathDelim + 'input.widestring'));
+
+ wsres := locService.EchoWideString(ws);
+ ms.Clear();
+ ms.Write(utf16_bom,SizeOf(utf16_bom));
+ ms.Write(Pointer(wsres)^, ( Length(wsres) * SizeOf(WideChar) ) );
+ ms.SaveToFile(ExpandFileName('.' + PathDelim + 'output.widestring'));
+ finally
+ ms.Free();
+ end;
+end.
+
diff --git a/wst/trunk/samples/widestring/server/echo_service.pas b/wst/trunk/samples/widestring/server/echo_service.pas
new file mode 100644
index 000000000..4ac31c74d
--- /dev/null
+++ b/wst/trunk/samples/widestring/server/echo_service.pas
@@ -0,0 +1,78 @@
+{
+This unit has been produced by ws_helper.
+ Input unit name : "echo_service".
+ This unit name : "echo_service".
+ Date : "06/04/2009 17:35:29".
+}
+unit echo_service;
+{$IFDEF FPC}
+ {$mode objfpc} {$H+}
+{$ENDIF}
+{$IFNDEF FPC}
+ {$DEFINE WST_RECORD_RTTI}
+{$ENDIF}
+interface
+
+uses SysUtils, Classes, TypInfo, base_service_intf, service_intf;
+
+const
+ sNAME_SPACE = 'uri:echo-service';
+ sUNIT_NAME = 'echo_service';
+
+type
+
+
+ IEchoService = interface(IInvokable)
+ ['{FCD0F68F-3023-46C6-AD09-1DDA4A2989EB}']
+ function EchoWideString(
+ const AValue : WideString
+ ):WideString;
+ end;
+
+ procedure Register_echo_service_ServiceMetadata();
+
+Implementation
+uses metadata_repository, record_rtti, wst_types;
+
+
+procedure Register_echo_service_ServiceMetadata();
+var
+ mm : IModuleMetadataMngr;
+begin
+ mm := GetModuleMetadataMngr();
+ mm.SetRepositoryNameSpace(sUNIT_NAME, sNAME_SPACE);
+ mm.SetServiceCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'FORMAT_Style',
+ 'rpc'
+ );
+ mm.SetOperationCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'EchoWideString',
+ '_E_N_',
+ 'EchoWideString'
+ );
+ mm.SetOperationCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'EchoWideString',
+ 'FORMAT_Input_EncodingStyle',
+ 'literal'
+ );
+ mm.SetOperationCustomData(
+ sUNIT_NAME,
+ 'IEchoService',
+ 'EchoWideString',
+ 'FORMAT_OutputEncodingStyle',
+ 'literal'
+ );
+end;
+
+
+initialization
+
+
+
+End.
diff --git a/wst/trunk/samples/widestring/server/echo_service.wst b/wst/trunk/samples/widestring/server/echo_service.wst
new file mode 100644
index 000000000..8e1db261d
--- /dev/null
+++ b/wst/trunk/samples/widestring/server/echo_service.wst
@@ -0,0 +1,5 @@
+ GetWSTResourceManager().AddResource('ECHO_SERVICE',
+ #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#12'echo_service'#1#0#0#0#12'IEchoServi'
+ +'ce'#1#0#0#0#14'EchoWideString'#2#0#0#0#6'AValue'#0#0#0#10'WideString'#0#0#0
+ +#0#0#0#0#1#0#0#0#6'Result'#0#0#0#10'WideString'#0#0#0#0#0#0#0#3''
+ );
\ No newline at end of file
diff --git a/wst/trunk/samples/widestring/server/echo_service_binder.pas b/wst/trunk/samples/widestring/server/echo_service_binder.pas
new file mode 100644
index 000000000..8eea8476e
--- /dev/null
+++ b/wst/trunk/samples/widestring/server/echo_service_binder.pas
@@ -0,0 +1,119 @@
+{
+This unit has been produced by ws_helper.
+ Input unit name : "echo_service".
+ This unit name : "echo_service_binder".
+ Date : "06/04/2009 17:35:29".
+}
+unit echo_service_binder;
+{$IFDEF FPC} {$mode objfpc}{$H+} {$ENDIF}
+interface
+
+uses SysUtils, Classes, base_service_intf, server_service_intf, echo_service;
+
+type
+
+
+ TEchoService_ServiceBinder = class(TBaseServiceBinder)
+ protected
+ procedure EchoWideStringHandler(AFormatter : IFormatterResponse; AContext : ICallContext);
+ public
+ constructor Create();
+ end;
+
+ TEchoService_ServiceBinderFactory = class(TInterfacedObject,IItemFactory)
+ private
+ FInstance : IInterface;
+ protected
+ function CreateInstance():IInterface;
+ public
+ constructor Create();
+ destructor Destroy();override;
+ end;
+
+ procedure Server_service_RegisterEchoServiceService();
+
+Implementation
+uses TypInfo, wst_resources_imp,metadata_repository;
+
+{ TEchoService_ServiceBinder implementation }
+procedure TEchoService_ServiceBinder.EchoWideStringHandler(AFormatter : IFormatterResponse; AContext : ICallContext);
+var
+ cllCntrl : ICallControl;
+ objCntrl : IObjectControl;
+ hasObjCntrl : Boolean;
+ tmpObj : IEchoService;
+ callCtx : ICallContext;
+ locStrPrmName : string;
+ procName,trgName : string;
+ AValue : WideString;
+ returnVal : WideString;
+begin
+ callCtx := AContext;
+
+ locStrPrmName := 'AValue'; AFormatter.Get(TypeInfo(WideString),locStrPrmName,AValue);
+
+ tmpObj := Self.GetFactory().CreateInstance() as IEchoService;
+ if Supports(tmpObj,ICallControl,cllCntrl) then
+ cllCntrl.SetCallContext(callCtx);
+ hasObjCntrl := Supports(tmpObj,IObjectControl,objCntrl);
+ if hasObjCntrl then
+ objCntrl.Activate();
+ try
+ returnVal := tmpObj.EchoWideString(AValue);
+
+ procName := AFormatter.GetCallProcedureName();
+ trgName := AFormatter.GetCallTarget();
+ AFormatter.Clear();
+ AFormatter.BeginCallResponse(procName,trgName);
+ AFormatter.Put('result',TypeInfo(WideString),returnVal);
+ AFormatter.EndCallResponse();
+
+ callCtx := nil;
+ finally
+ if hasObjCntrl then
+ objCntrl.Deactivate();
+ Self.GetFactory().ReleaseInstance(tmpObj);
+ end;
+end;
+
+
+constructor TEchoService_ServiceBinder.Create();
+begin
+ inherited Create(GetServiceImplementationRegistry().FindFactory('IEchoService'));
+ RegisterVerbHandler('EchoWideString',{$IFDEF FPC}@{$ENDIF}EchoWideStringHandler);
+end;
+
+
+{ TEchoService_ServiceBinderFactory }
+
+function TEchoService_ServiceBinderFactory.CreateInstance():IInterface;
+begin
+ Result := FInstance;
+end;
+
+constructor TEchoService_ServiceBinderFactory.Create();
+begin
+ FInstance := TEchoService_ServiceBinder.Create() as IInterface;
+end;
+
+destructor TEchoService_ServiceBinderFactory.Destroy();
+begin
+ FInstance := nil;
+ inherited Destroy();
+end;
+
+
+procedure Server_service_RegisterEchoServiceService();
+Begin
+ GetServerServiceRegistry().Register('IEchoService',TEchoService_ServiceBinderFactory.Create() as IItemFactory);
+End;
+
+initialization
+
+ {$i echo_service.wst}
+
+ {$IF DECLARED(Register_echo_service_ServiceMetadata)}
+ Register_echo_service_ServiceMetadata();
+ {$IFEND}
+
+End.
diff --git a/wst/trunk/samples/widestring/server/echo_service_imp.pas b/wst/trunk/samples/widestring/server/echo_service_imp.pas
new file mode 100644
index 000000000..a2459e1b6
--- /dev/null
+++ b/wst/trunk/samples/widestring/server/echo_service_imp.pas
@@ -0,0 +1,45 @@
+{
+This unit has been produced by ws_helper.
+ Input unit name : "echo_service".
+ This unit name : "echo_service_imp".
+ Date : "06/04/2009 17:25:42".
+}
+Unit echo_service_imp;
+{$IFDEF FPC} {$mode objfpc}{$H+} {$ENDIF}
+Interface
+
+Uses SysUtils, Classes,
+ base_service_intf, server_service_intf, server_service_imputils, echo_service;
+
+Type
+
+
+ TEchoService_ServiceImp=class(TBaseServiceImplementation,IEchoService)
+ Protected
+ function EchoWideString(
+ const AValue : WideString
+ ):WideString;
+ End;
+
+
+ procedure RegisterEchoServiceImplementationFactory();
+
+Implementation
+uses config_objects;
+
+{ TEchoService_ServiceImp implementation }
+function TEchoService_ServiceImp.EchoWideString(
+ const AValue : WideString
+):WideString;
+Begin
+ Result := AValue + AValue;
+End;
+
+
+
+procedure RegisterEchoServiceImplementationFactory();
+Begin
+ GetServiceImplementationRegistry().Register('IEchoService',TImplementationFactory.Create(TEchoService_ServiceImp,wst_GetServiceConfigText('IEchoService')) as IServiceImplementationFactory);
+End;
+
+End.
diff --git a/wst/trunk/samples/widestring/server/ws_server.lpi b/wst/trunk/samples/widestring/server/ws_server.lpi
new file mode 100644
index 000000000..fe51f2b28
--- /dev/null
+++ b/wst/trunk/samples/widestring/server/ws_server.lpi
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wst/trunk/samples/widestring/server/ws_server.pas b/wst/trunk/samples/widestring/server/ws_server.pas
new file mode 100644
index 000000000..73a7ed276
--- /dev/null
+++ b/wst/trunk/samples/widestring/server/ws_server.pas
@@ -0,0 +1,29 @@
+program ws_server;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}
+ cthreads, cwstring,
+ {$ENDIF}
+ Classes, SysUtils,
+ server_listener, server_service_intf, server_service_soap, indy_http_server,
+ echo_service, echo_service_binder, echo_service_imp;
+
+var
+ appObj : TwstListener;
+begin
+ Server_service_RegisterSoapFormat();
+ RegisterEchoServiceImplementationFactory();
+ Server_service_RegisterEchoServiceService();
+ appObj := TwstIndyHttpListener.Create();
+ try
+ appObj.Start();
+ WriteLn('WST Echo-Service sample. Hit any to stop.');
+ ReadLn;
+ appObj.Stop();
+ finally
+ appObj.Free();
+ end;
+end.
+