You've already forked lazarus-ccr
Handle the case of a method having the same name of its parent's service name, +test.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6681 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<definitions name="library1" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="library1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="library1">
|
||||
<types>
|
||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="library1" targetNamespace="library1"/>
|
||||
</types>
|
||||
<message name="inputMessage">
|
||||
<part name="one" type="xsd:string"/>
|
||||
</message>
|
||||
<message name="simpleOutputMessage" />
|
||||
<portType name="TestService">
|
||||
<operation name="TestService">
|
||||
<input message="tns:inputMessage"/>
|
||||
<output message="tns:simpleOutputMessage"/>
|
||||
</operation>
|
||||
</portType>
|
||||
<binding name="TestServiceBinding" type="tns:TestService">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="TestService">
|
||||
<soap:operation soapAction=""/>
|
||||
<input>
|
||||
<soap:body use="literal" namespace="library1"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="literal" namespace="library1"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
<service name="TestService">
|
||||
<port name="TestServicePort" binding="tns:TestServiceBinding">
|
||||
<soap:address location=""/>
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
@ -359,7 +359,8 @@ type
|
||||
procedure parameter_const_default();
|
||||
procedure parameter_composed_name();
|
||||
procedure parameter_composed_name_function();
|
||||
procedure method_composed_name();
|
||||
procedure method_composed_name();
|
||||
procedure method_same_name_interface();
|
||||
procedure soap_action();
|
||||
end;
|
||||
|
||||
@ -5658,6 +5659,60 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTest_WsdlParser.method_same_name_interface();
|
||||
const METHOD_NAME = 'TestService'; METHOD_ID = 'TestService'+s_WST_Method;
|
||||
var
|
||||
tr : TwstPasTreeContainer;
|
||||
|
||||
function FindProc(const AName : string; AIntf : TPasClassType) : TPasProcedure;
|
||||
var
|
||||
k : Integer;
|
||||
begin
|
||||
Result := nil;
|
||||
for k := 0 to (AIntf.Members.Count - 1) do begin
|
||||
if TObject(AIntf.Members[k]).InheritsFrom(TPasProcedure) and
|
||||
(tr.GetExternalName(TPasElement(AIntf.Members[k])) = AName)
|
||||
then begin
|
||||
Result := TPasProcedure(AIntf.Members[k]);
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
elt : TPasElement;
|
||||
intf : TPasClassType;
|
||||
mth : TPasProcedure;
|
||||
mthType : TPasProcedureType;
|
||||
res : TPasResultElement;
|
||||
arg : TPasArgument;
|
||||
i, c : Integer;
|
||||
begin
|
||||
tr := ParseDoc('function_same_name_interface');
|
||||
try
|
||||
elt := tr.FindElement('TestService');
|
||||
CheckNotNull(elt,'TestService');
|
||||
CheckIs(elt,TPasClassType);
|
||||
intf := elt as TPasClassType;
|
||||
CheckEquals(Ord(okInterface),Ord(intf.ObjKind));
|
||||
|
||||
c := 0;
|
||||
for i := 0 to (intf.Members.Count - 1) do begin
|
||||
if TObject(TObject(intf.Members[i])).InheritsFrom(TPasProcedure) then
|
||||
c := c+1;
|
||||
end;
|
||||
CheckEquals(1,c,'number of method');
|
||||
|
||||
mth := FindProc(METHOD_NAME,intf);
|
||||
CheckNotNull(mth,METHOD_NAME +' not found');
|
||||
CheckEquals(METHOD_ID,mth.Name,'internal name');
|
||||
mthType := mth.ProcType;
|
||||
CheckIs(mthType,TPasProcedureType);
|
||||
finally
|
||||
tr.Free();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTest_WsdlParser.soap_action();
|
||||
var
|
||||
tr : TwstPasTreeContainer;
|
||||
|
@ -910,14 +910,13 @@ begin
|
||||
if not ExtractOperationName(mthdName) then
|
||||
raise EXsdParserAssertException.CreateFmt('Operation Attribute not found : "%s"',[s_name]);
|
||||
DoOnMessage(mtInfo,Format('Parsing operation "%s"',[mthdName]));
|
||||
if SameText(s_document,ASoapBindingStyle) then begin
|
||||
ExtractMethod(mthdName,locMthd);
|
||||
if ( locMthd <> nil ) then begin
|
||||
AOwner.Members.Add(locMthd);
|
||||
end;
|
||||
end else if SameText(s_rpc,ASoapBindingStyle) then begin
|
||||
ExtractMethod(mthdName,locMthd);
|
||||
if ( locMthd <> nil ) then begin
|
||||
if SameText(s_document,ASoapBindingStyle) or
|
||||
SameText(s_rpc,ASoapBindingStyle)
|
||||
then begin
|
||||
ExtractMethod(mthdName,locMthd);
|
||||
if (locMthd <> nil) then begin
|
||||
if SameText(locMthd.Name,AOwner.Name) then
|
||||
locMthd.Name := locMthd.Name + s_WST_Method;
|
||||
AOwner.Members.Add(locMthd);
|
||||
end;
|
||||
end;
|
||||
|
@ -108,6 +108,7 @@ const
|
||||
s_WST_collection = 'wst_collection';
|
||||
s_WST_headerBlock = 'wst_headerBlock';
|
||||
s_WST_headerBlockSimpleContent = 'wst_headerBlockSimpleContent';
|
||||
s_WST_Method = 'Method';
|
||||
s_WST_record = 'wst_record';
|
||||
s_WST_storeType = 'StoreType';
|
||||
s_WST_typeHint = 'TypeHint';
|
||||
|
Reference in New Issue
Block a user