Web Service Toolkit Code Generation
Original Reporter info from Mantis: dyspd
-
Reporter name: Peter Dyson
Original Reporter info from Mantis: dyspd
- Reporter name: Peter Dyson
Description:
I imported a wsdl file from my Genealogy web server using WST Type Library editor.
This gave a root of urn:Genealogy with the relevant calls and interface.
The &LtPos;service name="GenealogyPort"> is translated to the root item under the interface node.
Testing a simple call resulted in failure, checking the web logs after increasing debug levels on the server I find the following soap message was sent.
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns1:serviceInfo xmlns:ns1="GenealogyPort"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Note the namespace for the serviceInfo method is GenealogyPort, and not urn:Genealogy as described in the wsdl.
after much debugging (gdb is painful for interfaces) I found the contents of the property manager for this call.
Property Manager contains
'Style=rpc'
'Style=rpc'
'address=http://10.0.2.117/genservice.php'
'soapAction=urn:Genealogy:PGVServiceLogic:serviceInfo'
All seems ok here so tried to debug the SoapFormatter, this was getting GenealogyPort asscociated with serviceInfo, and thus producing the erroneous &LtPos;ns1:serviceInfo xmlns:ns1="GenealogyPort"/>.
Looking at the generated Interface and Proxy code I found this generated routine.
Function wst_CreateInstance_GenealogyPort(const AFormat : string; const ATransport : string; const AAddress : string):GenealogyPort;
Var
locAdr : string;
Begin
locAdr := AAddress;
if ( locAdr = '' ) then
locAdr := GetServiceDefaultAddress(TypeInfo(GenealogyPort));
Result := TGenealogyPort_Proxy.Create('GenealogyPort',AFormat+GetServiceDefaultFormatProperties(TypeInfo(GenealogyPort)),ATransport + 'address=' + locAdr);
End;
Changing:
Result := TGenealogyPort_Proxy.Create('GenealogyPort',AFormat+GetServiceDefaultFormatProperties(TypeInfo(GenealogyPort)),ATransport + 'address=' + locAdr);
to
Result := TGenealogyPort_Proxy.Create('urn:Genealogy',AFormat+GetServiceDefaultFormatProperties(TypeInfo(GenealogyPort)),ATransport + 'address=' + locAdr);
Gave me a working soap message
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns1:serviceInfo xmlns:ns1="urn:Genealogy"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So I presume one of two things are happening (I don't fully understand the inner workings of WST as yet so which is a better fix I don't really know)
-
The code generation should be populating the namespace in wst_CreateInstance_xxxx routine as my simple fix above.
-
There is a bug in populating the PropertyManager instance in the SoapFormating class.
Steps to reproduce:
Good question as this is server specific and this server is not public.
Additional information:
Files can be supplied if the above information is not enough.
Mantis conversion info:
- Mantis ID: 25256
- OS: Linux
- OS Build: Mint16 x64
- Platform: Laz 1.0.12 fpc 2.6.2 and Trunk