You've already forked lazarus-ccr
Fix: Hyphens(-) support in procedure/function names of the service's interface.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4509 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
51
wst/trunk/tests/test_suite/files/function_composed_name.wsdl
Normal file
51
wst/trunk/tests/test_suite/files/function_composed_name.wsdl
Normal file
@ -0,0 +1,51 @@
|
||||
<?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-param" type="xsd:string"/>
|
||||
<part name="one-two-param" type="xsd:string"/>
|
||||
</message>
|
||||
<message name="simpleOutputMessage" />
|
||||
<message name="funcOutputMessage">
|
||||
<part name="one-two-param" type="xsd:string"/>
|
||||
<part name="result" type="xsd:string"/>
|
||||
</message>
|
||||
<portType name="TestService">
|
||||
<operation name="Composed-Name-Proc">
|
||||
<input message="tns:inputMessage"/>
|
||||
<output message="tns:simpleOutputMessage"/>
|
||||
</operation>
|
||||
<operation name="Composed-Name-Func">
|
||||
<input message="tns:inputMessage"/>
|
||||
<output message="tns:funcOutputMessage"/>
|
||||
</operation>
|
||||
</portType>
|
||||
<binding name="TestServiceBinding" type="tns:TestService">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="Composed-Name-Proc">
|
||||
<soap:operation soapAction=""/>
|
||||
<input>
|
||||
<soap:body use="literal" namespace="library1"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="literal" namespace="library1"/>
|
||||
</output>
|
||||
</operation>
|
||||
<operation name="Composed-Name-Func">
|
||||
<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>
|
@ -349,6 +349,7 @@ type
|
||||
procedure parameter_const_default();
|
||||
procedure parameter_composed_name();
|
||||
procedure parameter_composed_name_function();
|
||||
procedure method_composed_name();
|
||||
procedure soap_action();
|
||||
end;
|
||||
|
||||
@ -5163,6 +5164,67 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTest_WsdlParser.method_composed_name();
|
||||
const PROC_METHOD_NAME = 'Composed-Name-Proc'; PROC_METHOD_ID = 'Composed_Name_Proc';
|
||||
FUNC_METHOD_NAME = 'Composed-Name-Func'; FUNC_METHOD_ID = 'Composed_Name_Func';
|
||||
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_composed_name');
|
||||
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(2,c,'number of method');
|
||||
|
||||
mth := FindProc(PROC_METHOD_NAME,intf);
|
||||
CheckNotNull(mth,PROC_METHOD_NAME +' not found');
|
||||
CheckEquals(PROC_METHOD_ID,mth.Name,'internal name');
|
||||
mthType := mth.ProcType;
|
||||
CheckIs(mthType,TPasProcedureType);
|
||||
|
||||
mth := FindProc(FUNC_METHOD_NAME,intf);
|
||||
CheckNotNull(mth,FUNC_METHOD_NAME +' not found');
|
||||
CheckEquals(FUNC_METHOD_ID,mth.Name,'internal name');
|
||||
mthType := mth.ProcType;
|
||||
CheckIs(mthType,TPasFunctionType);
|
||||
finally
|
||||
tr.Free();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTest_WsdlParser.soap_action();
|
||||
var
|
||||
tr : TwstPasTreeContainer;
|
||||
|
@ -1480,7 +1480,9 @@ Var
|
||||
for k := 0 to Pred(mtds.Count) do begin
|
||||
if TPasElement(mtds[k]).InheritsFrom(TPasProcedure) then begin
|
||||
mtd := TPasProcedure(mtds[k]);
|
||||
WriteLn('RegisterVerbHandler(%s,{$IFDEF FPC}@{$ENDIF}%sHandler);',[QuotedStr(mtd.Name),mtd.Name]);
|
||||
WriteLn(
|
||||
'RegisterVerbHandler(%s,{$IFDEF FPC}@{$ENDIF}%sHandler);',
|
||||
[QuotedStr(FSymbolTable.GetExternalName(mtd)),mtd.Name]);
|
||||
end;
|
||||
end;
|
||||
EndAutoIndent();
|
||||
@ -1554,7 +1556,10 @@ Var
|
||||
WriteLn('procedure Server_service_Register%sService();',[strBuff]);
|
||||
WriteLn('Begin');
|
||||
IncIndent();
|
||||
WriteLn('GetServerServiceRegistry().Register(%s,T%s_ServiceBinderFactory.Create() as IItemFactory);',[QuotedStr(AIntf.Name),strBuff]);
|
||||
WriteLn(
|
||||
'GetServerServiceRegistry().Register(%s,T%s_ServiceBinderFactory.Create() as IItemFactory);',
|
||||
[QuotedStr(FSymbolTable.GetExternalName(AIntf)),strBuff]
|
||||
);
|
||||
DecIndent();
|
||||
WriteLn('End;');
|
||||
EndAutoIndent();
|
||||
|
@ -851,6 +851,7 @@ function TWsdlParser.ParseOperation(
|
||||
then begin
|
||||
locProcType := tmpMthd.ProcType;
|
||||
locFunc := TPasFunction(SymbolTable.CreateElement(TPasFunction,tmpMthd.Name,AOwner,visDefault,'',0));
|
||||
SymbolTable.RegisterExternalAlias(locFunc,SymbolTable.GetExternalName(tmpMthd));
|
||||
locFuncType := SymbolTable.CreateFunctionType('','Result',locFunc,False,'',0);
|
||||
locFunc.ProcType := locFuncType;
|
||||
resArgIndex := FindIndexOfResultArg(locProcType.Args);
|
||||
@ -880,8 +881,13 @@ function TWsdlParser.ParseOperation(
|
||||
|
||||
begin
|
||||
AMthd := nil;
|
||||
tmpMthd := TPasProcedure(SymbolTable.CreateElement(TPasProcedure,AMthdName,AOwner,visDefault,'',0));
|
||||
tmpMthd :=
|
||||
TPasProcedure(
|
||||
SymbolTable.CreateElement(TPasProcedure,ExtractIdentifier(AMthdName),
|
||||
AOwner,visDefault,'',0)
|
||||
);
|
||||
try
|
||||
SymbolTable.RegisterExternalAlias(tmpMthd,AMthdName);
|
||||
ParseInputMessage();
|
||||
ParseOutputMessage();
|
||||
except
|
||||
|
Reference in New Issue
Block a user