Page 1 of 2 1 2 LastLast
Results 1 to 15 of 19

Thread: type definitie na implementation

  1. #1
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747

    type definitie na implementation

    Bij 1 WSDL import krijg ik o.a. deze code te zien. Nu ken ik het fenomeen 'type' na de implementation niet.
    Delphi Code:
    1. // ************************************************************************ //
    2.   // Namespace : [url]http://webservices.client.florecom.org/Government/PortDefinitions[/url]
    3.   // soapAction: |[url]http://webservices.client.florecom.org/Government/exporter/PutCertificate_315||http://webservices.client.florecom.org/Government/exporter/GetCertificateStatus_301|http://webservices.client.florecom.org/Government/exporter/GetCertificateDocument_302[/url]
    4.   // transport : [url]http://schemas.xmlsoap.org/soap/http[/url]
    5.   // style     : document
    6.   // use       : literal
    7.   // binding   : KetenRegisterClientExport
    8.   // service   : GovernmentExporter
    9.   // port      : ExportPort
    10.   // URL       : [url]https://prepilotexport.bkd.eu/ws/krce_com.php[/url]
    11.   // ************************************************************************ //
    12.   GovernmentExporterPorts = interface(IInvokable)
    13.   ['{B8083D6B-2487-F925-BD13-372B9DCA91B2}']
    14.  
    15.     // Cannot unwrap:
    16.     //     - Input element wrapper name does not match operation's name
    17.     function  PutCertificate(const body: PutCertificateRequest): PutCertificateResponse; stdcall;
    18.  
    19.     // Cannot unwrap:
    20.     //     - Input element wrapper name does not match operation's name
    21.     function  PutCertificateCancel(const body: PutCertifcateCancelRequest): PutCertifcateCancelResponse; stdcall;
    22.  
    23.     // Cannot unwrap:
    24.     //     - Input element wrapper name does not match operation's name
    25.     //     - More than one strictly out element was found
    26.     function  GetCertificateStatus(const body: GetCertificateStatusRequest): GetCertificateStatusResponse; stdcall;
    27.  
    28.     // Cannot unwrap:
    29.     //     - Input element wrapper name does not match operation's name
    30.     //     - More than one strictly out element was found
    31.     function  GetAsyncCertificateStatus(const body: GetAsyncCertificateStatusRequest): GetAsyncCertificateStatusResponse; stdcall;
    32.  
    33.     // Cannot unwrap:
    34.     //     - Input element wrapper name does not match operation's name
    35.     function  GetInspection(const body: GetInspectionRequest): GetInspectionResponse; stdcall;
    36.  
    37.     // Cannot unwrap:
    38.     //     - Input element wrapper name does not match operation's name
    39.     function  GetCertificateDocument(const body: GetCertificateDocumentRequest): GetCertificateDocumentResponse; stdcall;
    40.   end;
    41.  
    42.  
    43.  
    44. implementation
    45.  
    46. type
    47.  
    48.   GovernmentExporterPortsImpl = class(TInvokableClass, GovernmentExporterPorts)
    49.   public
    50.     { GovernmentExporterPorts }
    51.  
    52.     // Cannot unwrap:
    53.     //     - Input element wrapper name does not match operation's name
    54.     function  PutCertificate(const body: PutCertificateRequest): PutCertificateResponse; stdcall;
    55.  
    56.     // Cannot unwrap:
    57.     //     - Input element wrapper name does not match operation's name
    58.     function  PutCertificateCancel(const body: PutCertifcateCancelRequest): PutCertifcateCancelResponse; stdcall;
    59.  
    60.     // Cannot unwrap:
    61.     //     - Input element wrapper name does not match operation's name
    62.     //     - More than one strictly out element was found
    63.     function  GetCertificateStatus(const body: GetCertificateStatusRequest): GetCertificateStatusResponse; stdcall;
    64.  
    65.     // Cannot unwrap:
    66.     //     - Input element wrapper name does not match operation's name
    67.     //     - More than one strictly out element was found
    68.     function  GetAsyncCertificateStatus(const body: GetAsyncCertificateStatusRequest): GetAsyncCertificateStatusResponse; stdcall;
    69.  
    70.     // Cannot unwrap:
    71.     //     - Input element wrapper name does not match operation's name
    72.     function  GetInspection(const body: GetInspectionRequest): GetInspectionResponse; stdcall;
    73.  
    74.     // Cannot unwrap:
    75.     //     - Input element wrapper name does not match operation's name
    76.     function  GetCertificateDocument(const body: GetCertificateDocumentRequest): GetCertificateDocumentResponse; stdcall;
    77.   end;
    78.  
    79. function GovernmentExporterPortsImpl.PutCertificate(const body: PutCertificateRequest): PutCertificateResponse;
    80. begin
    81.   { TODO - Implement method PutCertificate }
    82. end;
    83.  
    84. function GovernmentExporterPortsImpl.PutCertificateCancel(const body: PutCertifcateCancelRequest): PutCertifcateCancelResponse;
    85. begin
    86.   { TODO - Implement method PutCertificateCancel }
    87. end;
    88.  
    89. function GovernmentExporterPortsImpl.GetCertificateStatus(const body: GetCertificateStatusRequest): GetCertificateStatusResponse;
    90. begin
    91.   { TODO - Implement method GetCertificateStatus }
    92. end;
    93.  
    94. function GovernmentExporterPortsImpl.GetAsyncCertificateStatus(const body: GetAsyncCertificateStatusRequest): GetAsyncCertificateStatusResponse;
    95. begin
    96.   { TODO - Implement method GetAsyncCertificateStatus }
    97. end;
    98.  
    99. function GovernmentExporterPortsImpl.GetInspection(const body: GetInspectionRequest): GetInspectionResponse;
    100. begin
    101.   { TODO - Implement method GetInspection }
    102. end;
    103.  
    104. function GovernmentExporterPortsImpl.GetCertificateDocument(const body: GetCertificateDocumentRequest): GetCertificateDocumentResponse;
    105. begin
    106.   { TODO - Implement method GetCertificateDocument }
    107. end;

    Normaal voeg ik dit toe aan de WSDL import om de HTTPRio aan te sturen.
    Delphi Code:
    1. Function GetGovernmentExporterPorts(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GovernmentExporterPorts;
    2.  
    3. implementation
    4.  
    5. uses System.SysUtils, clDefaults;
    6.  
    7. function GetGovernmentExporterPorts(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GovernmentExporterPorts;
    8. const
    9. //  defWSDL = 'https://acclongexport.bkd.eu/ws/krce_com.php?wsdl';
    10. //  defURL  = 'https://acclongexport.bkd.eu/ws/krce_com.php';
    11.   defSvc  = 'GovernmentExporter';
    12.   defPrt  = 'ExportPort';
    13. var
    14.   RIO: THTTPRIO;
    15.   defWSDL : string;
    16.   defURL  : string;
    17.  begin
    18.   defWSDL := uDefaults.getvalue('WDSL_SITE') + '/' + uDefaults.getvalue('DEFKRCE') + '?wsdl';
    19.   defUrl  := uDefaults.getvalue('WDSL_SITE') + '/' + uDefaults.getvalue('DEFKRCE');
    20.   Result := nil;
    21.   if (Addr = '') then
    22.   begin
    23.     if UseWSDL then
    24.       Addr := defWSDL
    25.     else
    26.       Addr := defURL;
    27.   end;
    28.   if HTTPRIO = nil then
    29.     RIO := THTTPRIO.Create(nil)
    30.   else
    31.     RIO := HTTPRIO;
    32.   try
    33.     Result := (RIO as GovernmentExporterPorts);
    34.     if UseWSDL then
    35.     begin
    36.       RIO.WSDLLocation := Addr;
    37.       RIO.Service := defSvc;
    38.       RIO.Port := defPrt;
    39.     end else
    40.       RIO.URL := Addr;
    41.     //timeout connectie
    42.     RIO.HTTPWebNode.ConnectTimeout := RIO.HTTPWebNode.ConnectTimeout * 5;
    43. //    RIO.HTTPWebNode.SendTimeout := RIO.HTTPWebNode.SendTimeout * 5;
    44.     RIO.HTTPWebNode.ReceiveTimeout := RIO.HTTPWebNode.ReceiveTimeout * 5;
    45.  
    46.  
    47.   finally
    48.     if (Result = nil) and (HTTPRIO = nil) then
    49.       RIO.Free;
    50.   end;
    51. end;
    Maar als functie wordt aangeroepen, krijg ik de melding dat deze niet bestaat.

    Hoe roep ik nu de functie aan?
    Delphi is great. Lazarus is more powerfull

  2. #2
    mov rax,marcov; push rax marcov's Avatar
    Join Date
    Apr 2004
    Location
    Ehv, Nl
    Posts
    10,357
    type en var kunnen overal tussen functies in voor komen. Dus ook vlak na implementatie. Je foutmelding heeft niets daarmee te maken, de gewone regels gelden dan gewoon.

    Dit is een vrij gewone oplossing/patroon, een unit exporteert een interface in de interface (;-) en de implementatie wordt in het initializatie gedeelte van de unit in een of andere centrale lijst gehangen

  3. #3
    Quote Originally Posted by jkuiper View Post
    Delphi Code:
    1. // Cannot unwrap:
    2. //     - Input element wrapper name does not match operation's name
    En moest je al die "Cannot unwrap" ook niet oplossen.

    Volgens mij had jij daar wel een oplossing voor (volgens het NLDelphi archief)

  4. #4
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747
    Klopt, maar daar zit het probleem ook niet. Ik denk dat
    Delphi Code:
    1. function GetGovernmentExporterPorts(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GovernmentExporterPorts;
    moet worden
    Delphi Code:
    1. function GetGovernmentExporterPorts(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GovernmentExporterPortsImpl;
    Ik ben het alleen niet gewend en gebuik het niet eens op die manier.
    Delphi is great. Lazarus is more powerfull

  5. #5
    mov rax,marcov; push rax marcov's Avatar
    Join Date
    Apr 2004
    Location
    Ehv, Nl
    Posts
    10,357
    Let op, dat verschil kan nogal wat consequenties hebben agv refcounting!

  6. #6
    Maar als GovernmentExporterPorts in de interface staat zou je toch helemaal geen foutmelding mogen krijgen.
    Welke foutmelding krijg je precies.

    Tevens heb je ook niet de complete code gegeven (zoals tot de kop) dus dan blijft het gissen of het iets anders is wat er mis gaat.

  7. #7

  8. #8
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747
    Met Embarcadero gesproken en daar kreeg ik een werkende WSDELImport terug. er zit een bug in de code, die met Rio update 1 nog steeds niet is opgelost.
    Met die versie krijg ik een goede importbestand terug.
    Nu is er een verandering in de structuur en moet een nieuwe import ophalen. Die is iets anders, waardoor er een extra type definition na implementation. Ik kan wel de import hier posten, maar het zijn nogal wat regels.

    De link : https://we.tl/t-6mjgqPR5E6
    Delphi is great. Lazarus is more powerfull

  9. #9
    Dus, de truc zit aan het eind, in de initialization section:

    Delphi Code:
    1. initialization
    2.   { GovernmentExporterPorts }
    3.   InvRegistry.RegisterInterface(TypeInfo(GovernmentExporterPorts), 'http://webservices.client.florecom.org/Government/PortDefinitions', '');
    4.   { GovernmentExporterPorts - Server implementation class }
    5.   InvRegistry.RegisterInvokableClass(GovernmentExporterPortsImpl);

    Daar zie je de InvRegistry gebruikt worden, de invokation registry voor SOAP. THTTPRIO zou daar uit moeten kunnen putten.

    Wellicht kan je nog even checked wat er in jouw implementatie anders is dan in dit voorbeeld.

    En wat bedoel je precies met 'deze' in onderstaande zin? Welke fout krijg je precies?

    Maar als functie wordt aangeroepen, krijg ik de melding dat deze niet bestaat.
    1+1=b

  10. #10
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747
    Ik voeg dus de code van functie GetGovernmentExporterPorts toe (zie post 1) aan de WSDL import. Dat doe ik om extra informatie te sturen naar de THTTPRio object, waaronder timeouts configuratie.
    Nu is deze zo gedeclareerd:
    Delphi Code:
    1. Function GetGovernmentExporterPorts(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): [B]GovernmentExporterPorts[/B];
    Maar ik denk zelf dat het zo moet zijn:
    Delphi Code:
    1. Function GetGovernmentExporterPorts(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): [B]GovernmentExporterPortsImpl[/B];
    Quote Originally Posted by Goleztrol
    En wat bedoel je precies met 'deze' in onderstaande zin? Welke fout krijg je precies?
    Precies zoals ik het zeg. Als de functie wordt aangeroepen (Response := SOAPkrce.PutCertificate(Request) komt mijn progamma @runtime met de melding dat niet gevonden wordt.
    Delphi is great. Lazarus is more powerfull

  11. #11
    Dat wat niet gevonden wordt?

    Is het nou zo moeilijk om een volledige vraag te stellen, inclusief de geplakte foutmelding die je krijgt? Ik ga niet ergens een SOAP server op zitten tuigen, proberen op basis van halve informatie na te doen wat jij doet, en dan maar te hopen dat ik het probleem kan reproduceren.

    In ieder geval hoeft een functie niet per se de instance terug te geven. Het idee hier is dat er een interface is, en dat het er eigenlijk niet toe doet wat de implementatie is. Helaas is het wel weer op z'n Delphi's kruimig geimplementeerd, maar het theoretische idee om met interfaces te werken is prima. Jouw functie kan geen class instance teruggeven, omdat die class niet beschikbaar is op de plek waar je je functie wilt declareren. Je zal dus de class zichtbaar moeten maken, maar dat is niet handig. Beter is het om die import te laten voor wat ie is (zodat je die eventueel nog een keer opnieuw kan doen, zonder je aanpassingen kwijt te raken), en in een aparte unit een functie te maken die de interface teruggeeft.
    Last edited by GolezTrol; 22-Apr-19 at 23:26.
    1+1=b

  12. #12
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747
    Jos, ik krijg niet meer info van het systeem. Maar ik ga wel verder kijken.
    Delphi is great. Lazarus is more powerfull

  13. #13
    Je krijgt geen letterlijke foutmelding van het systeem?
    1+1=b

  14. #14
    Fornicatorus Formicidae VideoRipper's Avatar
    Join Date
    Mar 2005
    Location
    Vicus Saltus Orientalem
    Posts
    5,708
    Quote Originally Posted by GolezTrol View Post
    Je krijgt geen letterlijke foutmelding van het systeem?
    Dergelijke fouten krijg ik ook regelmatig; wel raar dat jij ze niet kent.

    Name:  DatNietGevondenWordt.png
Views: 603
Size:  10.3 KB
    TMemoryLeak.Create(Nil);

  15. #15
    Sorry, ik gebruik REST, geen SOAP.
    1+1=b

Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •