diff --git a/wst/trunk/base_json_formatter.pas b/wst/trunk/base_json_formatter.pas index d87b7067a..00f96e807 100644 --- a/wst/trunk/base_json_formatter.pas +++ b/wst/trunk/base_json_formatter.pas @@ -33,11 +33,15 @@ const s_json_name = 'name'; s_json_params = 'params'; s_json_result = 'result'; + s_json_version = 'version'; + s_json_rpc_version_10 = '1.0'; + s_json_rpc_version_11 = '1.1'; stNilScope = stBase + 7; type + TJonRPCVersion = ( jsonRPC_10, jsonRPC_11 ); TJsonInteger = Integer; TEnumIntType = Integer; diff --git a/wst/trunk/json_formatter.pas b/wst/trunk/json_formatter.pas index 6b029701f..887c18dcd 100644 --- a/wst/trunk/json_formatter.pas +++ b/wst/trunk/json_formatter.pas @@ -18,7 +18,7 @@ interface uses Classes, SysUtils, TypInfo, base_service_intf, service_intf, imp_utils, - base_json_formatter, fpjson; + base_json_formatter, fpjson, SyncObjs; type @@ -31,8 +31,12 @@ type FPropMngr : IPropertyManager; FCallProcedureName : string; FCallTarget : string; - protected + FVersion : string; + FVersionEnum : TJonRPCVersion; + private + procedure SetVersion(const AValue : string); public + constructor Create();override; function GetPropertyManager():IPropertyManager; procedure BeginCall( @@ -45,6 +49,9 @@ type function GetCallProcedureName():string; function GetCallTarget():string; + property VersionEnum : TJonRPCVersion read FVersionEnum; + published + property Version : string read FVersion write SetVersion; end; { TJsonRpcCallMaker } @@ -62,12 +69,66 @@ type ); End; + TJsonRpcCustomIdManager = class + public + function GetNewID() : PtrInt;virtual;abstract; + end; + + { TJsonRpcSequencedIdManager } + + TJsonRpcSequencedIdManager = class(TJsonRpcCustomIdManager) + private + FIdSequence : PtrInt; + FIdSequenceLock : TCriticalSection; + public + constructor Create(); + destructor Destroy();override; + function GetNewID() : PtrInt;override; + end; + procedure RegisterJsonProtocol(); + procedure SetIdManager(AValue : TJsonRpcCustomIdManager);{$IFDEF USE_INLINE}inline;{$ENDIF} + function GetIdManager():TJsonRpcCustomIdManager ;{$IFDEF USE_INLINE}inline;{$ENDIF} implementation +uses + StrUtils; + +var + FIdManager : TJsonRpcCustomIdManager; +function GetIdManager():TJsonRpcCustomIdManager ; +begin + Result := FIdManager; +end; + +procedure SetIdManager(AValue : TJsonRpcCustomIdManager); +begin + FreeAndNil(FIdManager); + FIdManager := AValue; +end; + { TJsonRpcFormatter } +procedure TJsonRpcFormatter.SetVersion(const AValue : string); +var + i : PtrInt; +begin + if ( FVersion = AValue ) then + Exit; + i := AnsiIndexStr(AValue,[s_json_rpc_version_10,s_json_rpc_version_11]); + if ( i < 0 ) then + Error('JSON-RPC version not supported : %s',[AValue]); + FVersion := AValue; + FVersionEnum := TJonRPCVersion(i); +end; + +constructor TJsonRpcFormatter.Create(); +begin + inherited Create(); + SetVersion(s_json_rpc_version_10); +end; + function TJsonRpcFormatter.GetPropertyManager() : IPropertyManager; begin If Not Assigned(FPropMngr) Then @@ -83,14 +144,37 @@ begin FCallProcedureName := AProcName; FCallTarget := ATarget; - BeginObject('',Nil); - Put(s_json_method,TypeInfo(string),FCallProcedureName); - BeginArray(s_json_params,Nil,nil,[0,0],asScoped); + case VersionEnum of + jsonRPC_10 : + begin + BeginObject('',Nil); + Put(s_json_method,TypeInfo(string),FCallProcedureName); + BeginArray(s_json_params,Nil,nil,[0,0],asScoped); + end; + jsonRPC_11 : + begin + BeginObject('',Nil); + Put(s_json_version,TypeInfo(string),Version); + Put(s_json_method,TypeInfo(string),FCallProcedureName); + BeginArray(s_json_params,Nil,nil,[0,0],asScoped); + end; + else + Error('JSON-RPC version not supported : %s',[Version]); + end; end; procedure TJsonRpcFormatter.EndCall(); +var + i : PtrInt; begin EndScope(); // params + if ( VersionEnum = jsonRPC_10 ) then begin + if Assigned(FIdManager) then + i := FIdManager.GetNewID() + else + i := 0; + Put(s_json_id,TypeInfo(PtrInt),i); + end; EndScope(); // Root object end; @@ -116,7 +200,7 @@ begin if ( i > -1 ) then errMsg := remoteErr.Items[i].AsString else - errMsg := ''; + errMsg := remoteErr.AsJSON; e := EJsonRpcException.Create(errMsg); e.FaultCode := errCode; e.FaultString := errMsg; @@ -197,7 +281,35 @@ begin ); end; -Initialization +{ TJsonRpcSequencedIdManager } + +constructor TJsonRpcSequencedIdManager.Create(); +begin + FIdSequenceLock := TCriticalSection.Create(); +end; + +destructor TJsonRpcSequencedIdManager.Destroy(); +begin + FreeAndNil(FIdSequenceLock); + inherited Destroy(); +end; + +function TJsonRpcSequencedIdManager.GetNewID() : PtrInt; +begin + FIdSequenceLock.Acquire(); + try + Inc(FIdSequence); + Result := FIdSequence; + finally + FIdSequenceLock.Release(); + end; +end; + +initialization + SetIdManager(TJsonRpcSequencedIdManager.Create()); RegisterJsonProtocol(); +finalization + FreeAndNil(FIdManager); + end. diff --git a/wst/trunk/library_protocol.pas b/wst/trunk/library_protocol.pas index 59d4e8995..18a3a9168 100644 --- a/wst/trunk/library_protocol.pas +++ b/wst/trunk/library_protocol.pas @@ -13,12 +13,12 @@ {$INCLUDE wst_global.inc} unit library_protocol; -//{$DEFINE WST_DBG} +{$DEFINE WST_DBG} interface uses - Classes, SysUtils,{$IFDEF WST_DBG}Dialogs,{$ENDIF} + Classes, SysUtils, service_intf, imp_utils, base_service_intf, library_base_intf, library_imp_utils; @@ -148,9 +148,7 @@ begin SetLength(s,AResponse.Size); AResponse.Read(s[1],AResponse.Size); if IsConsole then - WriteLn(s) - {else - ShowMessage(s);} + WriteLn(s); {$ENDIF WST_DBG} finally buffStream.Free(); diff --git a/wst/trunk/samples/library_server/lib_server.lpi b/wst/trunk/samples/library_server/lib_server.lpi index ebf1282b7..19c12b69f 100644 --- a/wst/trunk/samples/library_server/lib_server.lpi +++ b/wst/trunk/samples/library_server/lib_server.lpi @@ -7,7 +7,7 @@ - + @@ -25,15 +25,15 @@ - + - - + + - + @@ -42,7 +42,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -109,19 +109,19 @@ - - - - + + + + - - + + - + @@ -130,7 +130,7 @@ - + @@ -138,12 +138,132 @@ - + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wst/trunk/samples/user_client_console/user_client_console.lpi b/wst/trunk/samples/user_client_console/user_client_console.lpi index 0be4f36e2..801f54961 100644 --- a/wst/trunk/samples/user_client_console/user_client_console.lpi +++ b/wst/trunk/samples/user_client_console/user_client_console.lpi @@ -12,7 +12,7 @@ - + @@ -30,15 +30,15 @@ - + - - + + - + @@ -46,8 +46,8 @@ - - + + @@ -55,8 +55,8 @@ - - + + @@ -64,17 +64,17 @@ - - + + - + - - + + @@ -87,17 +87,19 @@ - - - + + + + + - - - - + + + + @@ -142,8 +144,8 @@ - - + + @@ -164,8 +166,8 @@ - - + + @@ -179,8 +181,8 @@ - - + + @@ -196,15 +198,15 @@ - + - - + + @@ -257,9 +259,11 @@ - - - + + + + + @@ -308,8 +312,8 @@ - - + + @@ -331,8 +335,8 @@ - - + + @@ -340,8 +344,8 @@ - - + + @@ -359,8 +363,8 @@ - - + + @@ -368,50 +372,104 @@ - - + + - - + + - + - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - + + + + + + + + + + + + + + @@ -456,12 +514,12 @@ - - - - + + + + diff --git a/wst/trunk/samples/user_client_console/user_client_console.pas b/wst/trunk/samples/user_client_console/user_client_console.pas index ab2cc3c68..22b1c2967 100644 --- a/wst/trunk/samples/user_client_console/user_client_console.pas +++ b/wst/trunk/samples/user_client_console/user_client_console.pas @@ -135,7 +135,7 @@ end; type TTransportType = ( ttLibrary, ttTCP, ttHTTP ); - TFormatType = ( ftBinary, ftSoap, ftXmlRPC, ftJSON ); + TFormatType = ( ftBinary, ftSoap, ftXmlRPC, ftJSON_10, ftJSON_11 ); var TransportType : TTransportType; FormatValue : TFormatType; @@ -148,20 +148,23 @@ const ADDRESS_MAP : array[TTransportType] of string = ( 'http:Address=http://127.0.0.1:8888/wst/services/lib_server/UserService' //'http:Address=http://127.0.0.1:8000/services/UserService' ); - FORMAT_MAP : array[TFormatType] of string =( 'binary', 'soap', 'xmlrpc', 'json' ); + FORMAT_MAP : array[TFormatType] of string =( 'binary', 'soap', 'xmlrpc', 'json', 'json' ); var - buff : string; + buffTransport, buffFormat : string; begin if ( TransportType = ttHTTP ) then - buff := Format('%s/?format=%s',[ADDRESS_MAP[TransportType],FORMAT_MAP[FormatValue]]) + buffTransport := Format('%s/?format=%s',[ADDRESS_MAP[TransportType],FORMAT_MAP[FormatValue]]) else - buff := ADDRESS_MAP[TransportType]; + buffTransport := ADDRESS_MAP[TransportType]; if ( TransportType = ttLibrary ) then - buff := StringReplace(buff,'\',DirectorySeparator,[rfReplaceAll, rfIgnoreCase]); + buffTransport := StringReplace(buffTransport,'\',DirectorySeparator,[rfReplaceAll, rfIgnoreCase]); + buffFormat := FORMAT_MAP[FormatValue] + ':'; + if ( FormatValue = ftJSON_11 ) then + buffFormat := Format('%sversion=%s',[buffFormat,'1.1']); UserServiceInst := TUserService_Proxy.Create( 'UserService', - FORMAT_MAP[FormatValue] + ':', - buff + buffFormat, + buffTransport ); end; @@ -197,7 +200,8 @@ begin WriteLn(); WriteLn('Select a messaging format : '); WriteLn(' B : binary ( binary_formatter.pas )'); - WriteLn(' J : JSON ( json_formatter.pas )'); + WriteLn(' J : JSON-RPC 1.0 ( json_formatter.pas )'); + WriteLn(' K : JSON-RPC 1.1 ( json_formatter.pas )'); WriteLn(' S : soap ( soap_formatter.pas )'); WriteLn(' X : XmlRpc ( xmlrpc_formatter.pas )'); WriteLn(); @@ -205,10 +209,11 @@ begin while True do begin ReadLn(buff); buff := UpperCase(Trim(buff)); - if ( Length(buff) > 0 ) and ( buff[1] in ['B', 'J', 'S', 'X'] ) then begin + if ( Length(buff) > 0 ) and ( buff[1] in ['B', 'J', 'K', 'S', 'X'] ) then begin case buff[1] of 'B' : FormatValue := ftBinary; - 'J' : FormatValue := ftJSON; + 'J' : FormatValue := ftJSON_10; + 'K' : FormatValue := ftJSON_11; 'S' : FormatValue := ftSoap; 'X' : FormatValue := ftXmlRPC; end; diff --git a/wst/trunk/server_binary_formatter.pas b/wst/trunk/server_binary_formatter.pas index 165ae4fc5..0eb42e797 100644 --- a/wst/trunk/server_binary_formatter.pas +++ b/wst/trunk/server_binary_formatter.pas @@ -71,6 +71,7 @@ end; procedure TBinaryFormatter.BeginCallResponse(const AProcName, ATarget: string); begin + Clear(); BeginObject('Body',Nil); BeginObject(ATarget,Nil); BeginObject(AProcName + 'Response',Nil); @@ -118,6 +119,7 @@ procedure TBinaryFormatter.BeginExceptionList( const AErrorMsg: string ); begin + Clear(); BeginObject('Body',Nil); BeginObject('Fault',Nil); Put('faultcode',TypeInfo(string),AErrorCode); diff --git a/wst/trunk/tests/test_suite/test_json.pas b/wst/trunk/tests/test_suite/test_json.pas new file mode 100644 index 000000000..b9d5f36f0 --- /dev/null +++ b/wst/trunk/tests/test_suite/test_json.pas @@ -0,0 +1,173 @@ +{ + This file is part of the Web Service Toolkit + Copyright (c) 2006, 2007 by Inoussa OUEDRAOGO + + This file is provide under modified LGPL licence + ( the files COPYING.modifiedLGPL and COPYING.LGPL). + + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +} +{$INCLUDE wst_global.inc} +unit test_json; + +interface + +uses + Classes, SysUtils, +{$IFDEF FPC} + fpcunit, testutils, testregistry, +{$ENDIF} +{$IFDEF WST_DELPHI} + TestFrameWork, ActiveX, +{$ENDIF} + TypInfo, + base_service_intf, wst_types, server_service_intf, service_intf, + fpjson, jsonparser, base_json_formatter, json_formatter, server_service_json, + testformatter_unit; + +type + + { TTestJsonRpcFormatter } + + TTestJsonRpcFormatter= class(TTestFormatter) + protected + class function GetFormaterName() : string;override; + function CreateFormatter(ARootType : PTypeInfo):IFormatterBase;override; + function Support_ComplextType_with_SimpleContent():Boolean;override; + function Support_nil():Boolean;override; + published + //procedure test_WriteBuffer(); + end; + + { TTest_JsonRpcFormatterExceptionBlock } + + TTest_JsonRpcFormatterExceptionBlock = class(TTestCase) + protected + function CreateFormatter():IFormatterResponse; + function CreateFormatterClient():IFormatterClient; + published + procedure ExceptBlock_server(); + procedure ExceptBlock_client(); + end; + +implementation + +{ TTestJsonRpcFormatter } + +class function TTestJsonRpcFormatter.GetFormaterName() : string; +begin + Result := 'json'; +end; + +function TTestJsonRpcFormatter.CreateFormatter(ARootType : PTypeInfo) : IFormatterBase; +begin +{$IFDEF FPC} + Result := TJsonRpcBaseFormatter.Create(); + Result.BeginObject('root',nil); +{$ENDIF} +end; + +function TTestJsonRpcFormatter.Support_ComplextType_with_SimpleContent() : Boolean; +begin + Result := True; +end; + +function TTestJsonRpcFormatter.Support_nil() : Boolean; +begin + Result := False; +end; + +{ TTest_JsonRpcFormatterExceptionBlock } + +function TTest_JsonRpcFormatterExceptionBlock.CreateFormatter() : IFormatterResponse; +begin + Result := server_service_json.TJsonRpcFormatter.Create() as IFormatterResponse; +end; + +function TTest_JsonRpcFormatterExceptionBlock.CreateFormatterClient() : IFormatterClient; +begin +{$IFDEF FPC} + Result := json_formatter.TJsonRpcFormatter.Create() as IFormatterClient; +{$ENDIF} +end; + +procedure TTest_JsonRpcFormatterExceptionBlock.ExceptBlock_server(); +const VAL_CODE = '1210'; VAL_MSG = 'This is a sample exception message.'; +var + f : IFormatterResponse; + strm : TMemoryStream; + locParser : TJSONParser; + root, errorNodeObj : TJSONObject; + errorNode, tmpNode : TJSONData; + excpt_code, excpt_msg : string; +begin + root := nil; + f := CreateFormatter(); + f.BeginExceptionList(VAL_CODE,VAL_MSG); + f.EndExceptionList(); + locParser := nil; + strm := TMemoryStream.Create(); + try + f.SaveToStream(strm); strm.SaveToFile('TTest_JsonRpcFormatterExceptionBlock.ExceptBlock_server.txt'); + strm.Position := 0; + locParser := TJSONParser.Create(strm); + root := locParser.Parse() as TJSONObject; + Check(Assigned(root)); + errorNode := root.Elements[s_json_error]; + Check(Assigned(errorNode),'Error'); + Check(errorNode.JSONType() = jtObject); + errorNodeObj := errorNode as TJSONObject; + Check(errorNodeObj.IndexOfName(s_json_code) >= 0, s_json_code); + Check(errorNodeObj.IndexOfName(s_json_message) >= 0, s_json_message); + excpt_code := errorNodeObj.Elements[s_json_code].AsString; + excpt_msg := errorNodeObj.Elements[s_json_message].AsString; + CheckEquals(VAL_CODE,excpt_code,'faultCode'); + CheckEquals(VAL_MSG,excpt_msg,'faultString'); + finally + locParser.Free(); + FreeAndNil(strm); + root.Free(); + end; +end; + +procedure TTest_JsonRpcFormatterExceptionBlock.ExceptBlock_client(); +const + VAL_CODE = '1210'; VAL_MSG = 'This is a sample exception message.'; + VAL_STREAM = '{ "result" : null, "error" : { "code" : ' + VAL_CODE + ', "message" : "' + VAL_MSG + '" } }'; +var + f : IFormatterClient; + strm : TStringStream; + excpt_code, excpt_msg : string; +begin + excpt_code := ''; + excpt_msg := ''; + f := CreateFormatterClient(); + strm := TStringStream.Create(VAL_STREAM); + try + strm.Position := 0; + f.LoadFromStream(strm); + try + f.BeginCallRead(nil); + Check(False,'BeginCallRead() should raise an exception.'); + except + on e : EJsonRpcException do begin + excpt_code := e.FaultCode; + excpt_msg := e.FaultString; + end; + end; + CheckEquals(VAL_CODE,excpt_code,'faultCode'); + CheckEquals(VAL_MSG,excpt_msg,'faultString'); + finally + FreeAndNil(strm); + end; +end; + + +initialization + RegisterTest('Serializer',TTestJsonRpcFormatter.Suite); + RegisterTest('Serializer',TTest_JsonRpcFormatterExceptionBlock.Suite); + +end. diff --git a/wst/trunk/tests/test_suite/testformatter_unit.pas b/wst/trunk/tests/test_suite/testformatter_unit.pas index 9352d5aea..d7da5c042 100644 --- a/wst/trunk/tests/test_suite/testformatter_unit.pas +++ b/wst/trunk/tests/test_suite/testformatter_unit.pas @@ -24,11 +24,7 @@ uses TestFrameWork, ActiveX, {$ENDIF} TypInfo, - base_service_intf, wst_types, server_service_intf, service_intf -{$IFDEF FPC} - , fpjson, jsonparser, base_json_formatter, json_formatter, server_service_json -{$ENDIF} - ; + base_service_intf, wst_types, server_service_intf, service_intf; type @@ -445,18 +441,6 @@ type procedure test_WriteBuffer(); end; - { TTestJsonRpcFormatter } - - TTestJsonRpcFormatter= class(TTestFormatter) - protected - class function GetFormaterName() : string;override; - function CreateFormatter(ARootType : PTypeInfo):IFormatterBase;override; - function Support_ComplextType_with_SimpleContent():Boolean;override; - function Support_nil():Boolean;override; - published - //procedure test_WriteBuffer(); - end; - { TTestArray } TTestArray= class(TTestCase) @@ -526,17 +510,6 @@ type procedure ExceptBlock_client(); end; - { TTest_JsonRpcFormatterExceptionBlock } - - TTest_JsonRpcFormatterExceptionBlock = class(TTestCase) - protected - function CreateFormatter():IFormatterResponse; - function CreateFormatterClient():IFormatterClient; - published - procedure ExceptBlock_server(); - procedure ExceptBlock_client(); - end; - { TTest_TStringBufferRemotable } TTest_TStringBufferRemotable = class(TTestCase) @@ -4244,116 +4217,6 @@ begin end; end; -{ TTestJsonRpcFormatter } - -class function TTestJsonRpcFormatter.GetFormaterName() : string; -begin - Result := 'json'; -end; - -function TTestJsonRpcFormatter.CreateFormatter(ARootType : PTypeInfo) : IFormatterBase; -begin -{$IFDEF FPC} - Result := TJsonRpcBaseFormatter.Create(); - Result.BeginObject('root',nil); -{$ENDIF} -end; - -function TTestJsonRpcFormatter.Support_ComplextType_with_SimpleContent() : Boolean; -begin - Result := True; -end; - -function TTestJsonRpcFormatter.Support_nil() : Boolean; -begin - Result := False; -end; - -{ TTest_JsonRpcFormatterExceptionBlock } - -function TTest_JsonRpcFormatterExceptionBlock.CreateFormatter() : IFormatterResponse; -begin - Result := server_service_json.TJsonRpcFormatter.Create() as IFormatterResponse; -end; - -function TTest_JsonRpcFormatterExceptionBlock.CreateFormatterClient() : IFormatterClient; -begin -{$IFDEF FPC} - Result := json_formatter.TJsonRpcFormatter.Create() as IFormatterClient; -{$ENDIF} -end; - -procedure TTest_JsonRpcFormatterExceptionBlock.ExceptBlock_server(); -const VAL_CODE = '1210'; VAL_MSG = 'This is a sample exception message.'; -var - f : IFormatterResponse; - strm : TMemoryStream; - locParser : TJSONParser; - root, errorNodeObj : TJSONObject; - errorNode, tmpNode : TJSONData; - excpt_code, excpt_msg : string; -begin - root := nil; - f := CreateFormatter(); - f.BeginExceptionList(VAL_CODE,VAL_MSG); - f.EndExceptionList(); - locParser := nil; - strm := TMemoryStream.Create(); - try - f.SaveToStream(strm); strm.SaveToFile('TTest_JsonRpcFormatterExceptionBlock.ExceptBlock_server.txt'); - strm.Position := 0; - locParser := TJSONParser.Create(strm); - root := locParser.Parse() as TJSONObject; - Check(Assigned(root)); - errorNode := root.Elements[s_json_error]; - Check(Assigned(errorNode),'Error'); - Check(errorNode.JSONType() = jtObject); - errorNodeObj := errorNode as TJSONObject; - Check(errorNodeObj.IndexOfName(s_json_code) >= 0, s_json_code); - Check(errorNodeObj.IndexOfName(s_json_message) >= 0, s_json_message); - excpt_code := errorNodeObj.Elements[s_json_code].AsString; - excpt_msg := errorNodeObj.Elements[s_json_message].AsString; - CheckEquals(VAL_CODE,excpt_code,'faultCode'); - CheckEquals(VAL_MSG,excpt_msg,'faultString'); - finally - locParser.Free(); - FreeAndNil(strm); - root.Free(); - end; -end; - -procedure TTest_JsonRpcFormatterExceptionBlock.ExceptBlock_client(); -const - VAL_CODE = '1210'; VAL_MSG = 'This is a sample exception message.'; - VAL_STREAM = '{ "result" : null, "error" : { "code" : ' + VAL_CODE + ', "message" : "' + VAL_MSG + '" } }'; -var - f : IFormatterClient; - strm : TStringStream; - excpt_code, excpt_msg : string; -begin - excpt_code := ''; - excpt_msg := ''; - f := CreateFormatterClient(); - strm := TStringStream.Create(VAL_STREAM); - try - strm.Position := 0; - f.LoadFromStream(strm); - try - f.BeginCallRead(nil); - Check(False,'BeginCallRead() should raise an exception.'); - except - on e : EJsonRpcException do begin - excpt_code := e.FaultCode; - excpt_msg := e.FaultString; - end; - end; - CheckEquals(VAL_CODE,excpt_code,'faultCode'); - CheckEquals(VAL_MSG,excpt_msg,'faultString'); - finally - FreeAndNil(strm); - end; -end; - initialization RegisterStdTypes(); GetTypeRegistry().Register(sXSD_NS,TypeInfo(TTestEnum),'TTestEnum').RegisterExternalPropertyName('teOne', '1'); @@ -4418,9 +4281,5 @@ initialization RegisterTest('Serializer',TTest_XmlRpcFormatterExceptionBlock.Suite); RegisterTest('Serializer',TTest_BinaryFormatterExceptionBlock.Suite); RegisterTest('Serializer',TTest_TStringBufferRemotable.Suite); -{$IFDEF FPC} - RegisterTest('Serializer',TTestJsonRpcFormatter.Suite); - RegisterTest('Serializer',TTest_JsonRpcFormatterExceptionBlock.Suite); -{$ENDIF} end.