0
votes

I have imported a WSDL from file and his .xsd schema to Delphi. In this case I don't know how can I insert value to the request because the TRemotable class no have private neither published declaration just has Create constructor. The WSDL use .xsd schema. When I execute my program it's connecting to the server and I need to confirm the certificate (it's normal) but after that I receive an error: "Input data does not match the XML schema definition". I think because the request sending without input string. (I have tried in SoapUI to sending without input string and received the same response). Please could you explain me how can I insert values to the request use a schema?

I tried how does WSDL work in SoapUI and it's working fine, it's a simple method to test the server. I write a string to input and the server is send back in response the same string if it's working.

Part of imported WSDL:

  // ************************************************************************ //
  // XML       : SupportPingRequest, global, <element>
  // Namespace : urn:wsdltypes.nmvs.eu:v2.0
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  SupportPingRequest = class(TRemotable)
  private
  public
    constructor Create; override;
  published
  end;


  // ************************************************************************ //
  // XML       : SupportPingResponse, global, <element>
  // Namespace : urn:wsdltypes.nmvs.eu:v2.0
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  SupportPingResponse = class(TRemotable)
  private
  public
    constructor Create; override;
  published
  end;



  // ************************************************************************ //
  // Namespace : urn:services.nmvs.eu:v2.0
  // soapAction: |urn:PingSupport|urn:G445ChangePassword|urn:G482LoadTC|urn:G483ConfirmTC
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : WSHttpBinding_ISupportServices
  // service   : SupportServices
  // port      : Port_SupportServices
  // URL       : http://localhost:8080/WS_SUPPORT_V1/SupportServiceV10
  // ************************************************************************ //
  ISupportServices = interface(IInvokable)
  ['{A99C22A3-2FE1-EF7A-C0D6-2881F888FE1C}']

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    function  PingSupport(const messageParameters: SupportPingRequest): SupportPingResponse; stdcall;

  end;

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

My code:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
  WS_PKI, WS_SUPPORT;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  Service: ISupportServices;
  req: SupportPingRequest;
  res: SupportPingResponse;

begin
  req:= SupportPingRequest.Create;

  try
    GetISupportServices.PingSupport(req);
  finally
    req.Free;
  end;

end;

end.

==EDIT==

SoapUI request: (I'd like to insert the urn1:Input value in Delphi)

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:wsdltypes.nmvs.eu:v2.0" xmlns:urn1="urn:types.nmvs.eu:v2.0">
   <soap:Header/>
   <soap:Body>
      <urn:SupportPingRequest>
         <urn1:Input>test string</urn1:Input>
      </urn:SupportPingRequest>
   </soap:Body>
</soap:Envelope>

SoapUI response:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
   <soap:Body>
      <ns2:SupportPingResponse xmlns:ns1="urn:types.nmvs.eu:v2.0" xmlns:ns2="urn:wsdltypes.nmvs.eu:v2.0">
         <ns1:Output>test string</ns1:Output>
      </ns2:SupportPingResponse>
   </soap:Body>
</soap:Envelope>
1

1 Answers

0
votes

Finally has problem with Delphi 10.2.3 that imported wrong the WSDL file and half of the classes was missing. I have upgrade to 10.3 and imported the file correctly.