From 63905d2f6806fc63a5161331c304805fc050d95a Mon Sep 17 00:00:00 2001 From: inoussa Date: Mon, 9 Jun 2008 15:04:39 +0000 Subject: [PATCH] Name space declared in parent nodes must be available to child node : for target name extracting; Thanks to Shaun Simpson. + update + test case git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@479 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/server_service_soap.pas | 5 +-- .../tests/test_suite/testformatter_unit.pas | 44 ++++++++++++++++++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/wst/trunk/server_service_soap.pas b/wst/trunk/server_service_soap.pas index 2fe5d150c..9d70b32f7 100644 --- a/wst/trunk/server_service_soap.pas +++ b/wst/trunk/server_service_soap.pas @@ -147,10 +147,7 @@ begin FCallProcedureName := ExtractNamePart(s); If IsStrEmpty(FCallProcedureName) Then Error('No Method name.'); - tmpNode := mthdNd.Attributes.GetNamedItem(sXML_NS + ':' + nsShortName); - If Not Assigned(tmpNode) Then - Error('Call target attribute not found.'); - FCallTarget := tmpNode.NodeValue; + FCallTarget := FindAttributeByNameInScope(sXML_NS + ':' + nsShortName); end; function TSOAPFormatter.GetCallProcedureName(): String; diff --git a/wst/trunk/tests/test_suite/testformatter_unit.pas b/wst/trunk/tests/test_suite/testformatter_unit.pas index d5a22529a..14c1cd1c0 100644 --- a/wst/trunk/tests/test_suite/testformatter_unit.pas +++ b/wst/trunk/tests/test_suite/testformatter_unit.pas @@ -517,6 +517,12 @@ type procedure Assign(); end; + { TTest_SoapFormatterServerNameSpace } + + TTest_SoapFormatterServerNameSpace = class(TTestCase) + published + procedure namespace_declared_env(); + end; implementation uses base_binary_formatter, base_soap_formatter, base_xmlrpc_formatter, record_rtti, @@ -4173,6 +4179,42 @@ begin end; end; +{ TTest_SoapFormatterServerNameSpace } + +procedure TTest_SoapFormatterServerNameSpace.namespace_declared_env(); +const + XML_SOURCE = + ' ' + sLineBreak + + ' ' + sLineBreak + + ' ' + sLineBreak + + ' ' + sLineBreak + + ' ' + sLineBreak + + ''; +var + f : IFormatterResponse; + strm : TMemoryStream; + strBuffer : ansistring; + cctx : ICallContext; +begin + f := server_service_soap.TSOAPFormatter.Create() as IFormatterResponse; + strm := TMemoryStream.Create(); + try + strBuffer := XML_SOURCE; + strm.Write(strBuffer[1],Length(strBuffer)); + strm.Position := 0; + f.LoadFromStream(strm); + cctx := TSimpleCallContext.Create() as ICallContext; + f.BeginCallRead(cctx); + strBuffer := f.GetCallProcedureName(); + CheckEquals('GetVersion',strBuffer, 'GetCallProcedureName()'); + f.EndScopeRead(); + finally + FreeAndNil(strm); + end; +end; + initialization RegisterStdTypes(); GetTypeRegistry().Register(sXSD_NS,TypeInfo(TTestEnum),'TTestEnum').RegisterExternalPropertyName('teOne', '1'); @@ -4237,5 +4279,5 @@ initialization RegisterTest('Serializer',TTest_XmlRpcFormatterExceptionBlock.Suite); RegisterTest('Serializer',TTest_BinaryFormatterExceptionBlock.Suite); RegisterTest('Serializer',TTest_TStringBufferRemotable.Suite); - + RegisterTest('Serializer',TTest_SoapFormatterServerNameSpace.Suite); end.