Einzelnen Beitrag anzeigen

zahnmeissel

Registriert seit: 3. Jan 2011
3 Beiträge
 
#1

WSDL wird von Delphi XE3 falsch importiert

  Alt 25. Okt 2016, 08:03
Delphi-Version: XE3
Guten Morgen Zusammen,

mit dem WSDL-Importer von Delphi möchte ich folgendes WSDL importieren:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="CalculationService" targetNamespace="http://services.ws.dvce.fce.ford.com/" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:tns="http://services.ws.dvce.fce.ford.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
   <types>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://services.ws.dvce.fce.ford.com/" version="1.0" targetNamespace="http://services.ws.dvce.fce.ford.com/">

         <xs:element name="AdditionalInformation" type="tns:AdditionalInformation"/>

         <xs:element name="calculate" type="tns:calculate"/>

         <xs:complexType name="calculate">
            <xs:sequence>
               <xs:element ref="tns:AdditionalInformation" minOccurs="0"/>
            </xs:sequence>
         </xs:complexType>

         <xs:complexType name="AdditionalInformation">
            <xs:sequence>
               <xs:element name="requestedResponseElements" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
         </xs:complexType>

      </xs:schema>
   </types>
   <message name="calculate">
      <part name="parameters" element="tns:calculate">
      </part>
   </message>
   <portType name="CalculationService">
      <operation name="calculate">
         <input message="tns:calculate" wsam:Action="CalculationService.calculate">
         </input>
      </operation>
   </portType>
   <binding name="CalculationServicePortBinding" type="tns:CalculationService">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="calculate">
         <soap:operation soapAction="CalculationService.calculate"/>
         <input>
            <soap:body use="literal"/>
         </input>
         <output>
            <soap:body use="literal"/>
         </output>
      </operation>
   </binding>
   <service name="CalculationService">
      <port name="CalculationServicePort" binding="tns:CalculationServicePortBinding">
         <soap:address location="http://localhost:11000/DEVICEWebNew/CalculationService"/>
      </port>
   </service>
</definitions>
Aber was Delphi daraus macht verstehe ich nicht und hoffe auf Eure Hilfe. Dies ist das von Delphi erzeugte Ergebnis:

Delphi-Quellcode:
// ************************************************************************ //
// Die in dieser Datei deklarierten Typen wurden aus Daten der unten
// beschriebenen WSDL-Datei generiert:

// WSDL : C:\temp\device\DEVICEEAR.ear\DEVICEWeb.war\generatedWSDLDir\DEVICEWebNew\Strip\CalculationService.wsdl
// >Import : C:\temp\device\DEVICEEAR.ear\DEVICEWeb.war\generatedWSDLDir\DEVICEWebNew\Strip\CalculationService.wsdl>0
// Codierung : UTF-8
// Version: 1.0
// (25.10.2016 08:52:10 - - $Rev: 52705 $)
// ************************************************************************ //

unit CalculationService1;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_UNQL = $0008;
  IS_REF = $0080;


type

  // ************************************************************************ //
  // Die folgenden Typen, auf die im WSDL-Dokument Bezug genommen wird, sind in dieser Datei
  // nicht repräsentiert. Sie sind entweder Aliase[@] anderer repräsentierter Typen oder auf sie wurde Bezug genommen,
  // aber sie sind in diesem Dokument nicht[!] deklariert. Die Typen aus letzterer Kategorie
  // sind in der Regel vordefinierten/bekannten XML- oder Embarcadero-Typen zugeordnet; sie könnten aber auf
  // ein inkorrektes WSDL-Dokument hinweisen, das einen Schematyp nicht deklariert oder importiert hat.
  // ************************************************************************ //
  // !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]


  AdditionalInformation2 = array of string; { "http://services.ws.dvce.fce.ford.com/"[GblCplx] }
  AdditionalInformation = type AdditionalInformation2; { "http://services.ws.dvce.fce.ford.com/"[GblElm] }

  // ************************************************************************ //
  // Namespace : http://services.ws.dvce.fce.ford.com/
  // soapAction: CalculationService.calculate
  // Transport : http://schemas.xmlsoap.org/soap/http
  // Stil : document
  // Verwenden von : literal
  // Bindung : CalculationServicePortBinding
  // Service : CalculationService
  // Port : CalculationServicePort
  // URL : http://localhost:11000/DEVICEWebNew/CalculationService
  // ************************************************************************ //
  CalculationService = interface(IInvokable)
  ['{E69DA24C-3802-99B3-0DAB-BB685B78C809}']
    procedure calculate(const AdditionalInformation: AdditionalInformation); stdcall;
  end;

function GetCalculationService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): CalculationService;


implementation
  uses SysUtils;

function GetCalculationService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): CalculationService;
const
  defWSDL = 'C:\temp\device\DEVICEEAR.ear\DEVICEWeb.war\generatedWSDLDir\DEVICEWebNew\Strip\CalculationService.wsdl';
  defURL = 'http://localhost:11000/DEVICEWebNew/CalculationService';
  defSvc = 'CalculationService';
  defPrt = 'CalculationServicePort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as CalculationService);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  { CalculationService }
  InvRegistry.RegisterInterface(TypeInfo(CalculationService), 'http://services.ws.dvce.fce.ford.com/', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(CalculationService), 'CalculationService.calculate');
  InvRegistry.RegisterInvokeOptions(TypeInfo(CalculationService), ioDocument);
  { CalculationService.calculate }
  InvRegistry.RegisterParamInfo(TypeInfo(CalculationService), 'calculate', 'AdditionalInformation', '',
                                '', IS_REF);
  RemClassRegistry.RegisterXSInfo(TypeInfo(AdditionalInformation2), 'http://services.ws.dvce.fce.ford.com/', 'AdditionalInformation2', 'AdditionalInformation');
  RemClassRegistry.RegisterXSInfo(TypeInfo(AdditionalInformation), 'http://services.ws.dvce.fce.ford.com/', 'AdditionalInformation');

end.
Da im WSDL "AdditionalInforamtion" als complexType definiert ist hätte ich auch erwartet dass Delphi daraus die Klasse "AdditionalInformation" generiert.
Also in etwa so:

Delphi-Quellcode:
  AdditionalInformation2 = class; { "http://services.ws.dvce.fce.ford.com/"[GblCplx] }
  AdditionalInformation = class; { "http://services.ws.dvce.fce.ford.com/"[GblElm] }



  Array_of_String = array of string;

  // ************************************************************************ //
  // XML : AdditionalInformation, global, <complexType>
  // Namespace : http://services.ws.dvce.fce.ford.com/
  // ************************************************************************ //
  AdditionalInformation2 = class(TRemotable)
  private
    FrequestedResponseElements: Array_of_String;
    FrequestedResponseElements_Specified: boolean;
    procedure SetrequestedResponseElements(Index: Integer; const Values: Array_of_String);
    function requestedResponseElements_Specified(Index: Integer): boolean;
  published
    property requestedResponseElements: Array_of_String Index (IS_OPTN or IS_UNQL) read FrequestedResponseElements write SetrequestedResponseElements stored requestedResponseElements_Specified;
  end;



  // ************************************************************************ //
  // XML : AdditionalInformation, global, <element>
  // Namespace : http://services.ws.dvce.fce.ford.com/
  // ************************************************************************ //
  AdditionalInformation = class(AdditionalInformation2)
  private
  published
  end;
Mir ist schleierhaft wieso Delphi aus "AdditionalInformation" ein Array generiert.

Wenn ich das in Eclipse importiere oder mir über SoapUI aus dem WSDL einen Request erzeugen lassen funktioniert alles wie erwartet!

Ist Euch sowas schon einmal untergekommen?
Habt Ihr eine Idee wie das zu lösen ist?
Habe ich irgendwo ein Häkchen vergessen oder ist das WSDL falsch?

Das WSDL liegt unter meiner Kontrolle und kann entsprechend den Anforderungen geändert werden!

Vielen Dank für Eure Bemühungen!

Gruß
Falk Termast
  Mit Zitat antworten Zitat