AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Problem beim SOAP Abruf

Ein Thema von Blackpit · begonnen am 15. Jan 2020 · letzter Beitrag vom 22. Jan 2020
Antwort Antwort
Seite 1 von 2  1 2      
Blackpit

Registriert seit: 27. Feb 2019
77 Beiträge
 
#1

Problem beim SOAP Abruf

  Alt 15. Jan 2020, 14:03
Hallo,
ich hab hier ein Problem das ich mir nicht erklären kann.
Beim Abruf eines Webservice über das importierte WSDL bekomme ich folgende Meldung:
Zitat:
'Die Anforderung konnte vom Server nicht verarbeitet werden. ---> Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.'
Interface (Auszug):

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

// WSDL : https://...de/services/api/salesservice.asmx?WSDL
// >Import : https://...de/services/api/salesservice.asmx?WSDL>0
// Codierung : utf-8
// Codegen : [wfForceSOAP12+]
// Version: 1.0
// (13.01.2020 15:14:48 - - $Rev: 76228 $)
// ************************************************************************ //

unit salesservice;

interface

uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_NLBL = $0004;
  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.
  // ************************************************************************ //
  // !:int - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:decimal - "http://www.w3.org/2001/XMLSchema"[Gbl]

  DealerInformationModel = class; { "http://www.servadr.de/"[GblCplx] }
  WebLogin2 = class; { "http://www.servadr.de/"[Hdr][GblCplx] }
  WebLogin = class; { "http://www.servadr.de/"[Hdr][GblElm] }
  CompleteVehicleInformationModel = class; { "http://www.servadr.de/"[GblCplx] }
  PaymentConditionModel = class; { "http://www.servadr.de/"[GblCplx] }
  EquipmentModel = class; { "http://www.servadr.de/"[GblCplx] }

...
  // ************************************************************************ //
  // XML : WebLogin, global, <complexType>
  // Namespace : http://www.servadr.de/
  // Info : Header
  // ************************************************************************ //
  WebLogin2 = class(TSOAPHeader)
  private
    FUser: string;
    FUser_Specified: boolean;
    FPassword: string;
    FPassword_Specified: boolean;
    FLanguage: Integer;
    procedure SetUser(Index: Integer; const Astring: string);
    function User_Specified(Index: Integer): boolean;
    procedure SetPassword(Index: Integer; const Astring: string);
    function Password_Specified(Index: Integer): boolean;
  published
    property User: string Index (IS_OPTN) read FUser write SetUser stored User_Specified;
    property Password: string Index (IS_OPTN) read FPassword write SetPassword stored Password_Specified;
    property Language: Integer read FLanguage write FLanguage;
  end;



  // ************************************************************************ //
  // XML : WebLogin, global, <element>
  // Namespace : http://www.web-kat.de/
  // Info : Header
  // ************************************************************************ //
  WebLogin = class(WebLogin2)
  private
  published
  end;

  ArrayOfEquipmentModel = array of EquipmentModel; { "http://www.servadr.de/"[GblCplx] }
...

  // ************************************************************************ //
  // XML : CompleteVehicleInformationModel, global, <complexType>
  // Namespace : http://www.servadr.de/
  // ************************************************************************ //
  CompleteVehicleInformationModel = class(TRemotable)
  private
    FDealerInformation: DealerInformationModel;
    FDealerInformation_Specified: boolean;
    FEquipment: ArrayOfEquipmentModel;
    FEquipment_Specified: boolean;
    FPaymentConditions: ArrayOfPaymentConditionModel;
    FPaymentConditions_Specified: boolean;
    procedure SetDealerInformation(Index: Integer; const ADealerInformationModel: DealerInformationModel);
    function DealerInformation_Specified(Index: Integer): boolean;
    procedure SetEquipment(Index: Integer; const AArrayOfEquipmentModel: ArrayOfEquipmentModel);
    function Equipment_Specified(Index: Integer): boolean;
    procedure SetPaymentConditions(Index: Integer; const AArrayOfPaymentConditionModel: ArrayOfPaymentConditionModel);
    function PaymentConditions_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property DealerInformation: DealerInformationModel Index (IS_OPTN) read FDealerInformation write SetDealerInformation stored DealerInformation_Specified;
    property Equipment: ArrayOfEquipmentModel Index (IS_OPTN) read FEquipment write SetEquipment stored Equipment_Specified;
    property PaymentConditions: ArrayOfPaymentConditionModel Index (IS_OPTN) read FPaymentConditions write SetPaymentConditions stored PaymentConditions_Specified;
  end;
...
  // ************************************************************************ //
  // XML : EquipmentModel, global, <complexType>
  // Namespace : http://www.servadr.de/
  // ************************************************************************ //
  EquipmentModel = class(TRemotable)
  private
    FOrderPos: string;
    FOrderPos_Specified: boolean;
    FCondition: string;
    FCondition_Specified: boolean;
    FDescription: string;
    FDescription_Specified: boolean;
    FVarcond: string;
    FVarcond_Specified: boolean;
    FAmount: string;
    FAmount_Specified: boolean;
    FQuantity: TXSDecimal;
    FUnit_: string;
    FUnit__Specified: boolean;
    FTotalAmount: string;
    FTotalAmount_Specified: boolean;
    FCurrency: string;
    FCurrency_Specified: boolean;
    FListPrice: TXSDecimal;
    procedure SetOrderPos(Index: Integer; const Astring: string);
    function OrderPos_Specified(Index: Integer): boolean;
    procedure SetCondition(Index: Integer; const Astring: string);
    function Condition_Specified(Index: Integer): boolean;
    procedure SetDescription(Index: Integer; const Astring: string);
    function Description_Specified(Index: Integer): boolean;
    procedure SetVarcond(Index: Integer; const Astring: string);
    function Varcond_Specified(Index: Integer): boolean;
    procedure SetAmount(Index: Integer; const Astring: string);
    function Amount_Specified(Index: Integer): boolean;
    procedure SetUnit_(Index: Integer; const Astring: string);
    function Unit__Specified(Index: Integer): boolean;
    procedure SetTotalAmount(Index: Integer; const Astring: string);
    function TotalAmount_Specified(Index: Integer): boolean;
    procedure SetCurrency(Index: Integer; const Astring: string);
    function Currency_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property OrderPos: string Index (IS_OPTN) read FOrderPos write SetOrderPos stored OrderPos_Specified;
    property Condition: string Index (IS_OPTN) read FCondition write SetCondition stored Condition_Specified;
    property Description: string Index (IS_OPTN) read FDescription write SetDescription stored Description_Specified;
    property Varcond: string Index (IS_OPTN) read FVarcond write SetVarcond stored Varcond_Specified;
    property Amount: string Index (IS_OPTN) read FAmount write SetAmount stored Amount_Specified;
    property Quantity: TXSDecimal read FQuantity write FQuantity;
    property Unit_: string Index (IS_OPTN) read FUnit_ write SetUnit_ stored Unit__Specified;
    property TotalAmount: string Index (IS_OPTN) read FTotalAmount write SetTotalAmount stored TotalAmount_Specified;
    property Currency: string Index (IS_OPTN) read FCurrency write SetCurrency stored Currency_Specified;
    property ListPrice: TXSDecimal Index (IS_NLBL) read FListPrice write FListPrice;
  end;


  // ************************************************************************ //
  // Namespace : http://www.servadr.de/
  // soapAction: http://www.servadr.de/%operationName%
  // Transport : http://schemas.xmlsoap.org/soap/http
  // Stil : document
  // Verwenden von : literal
  // Bindung : SalesServiceSoap12
  // Service : SalesService
  // Port : SalesServiceSoap12
  // URL : https://***.servadr.de/services/api/salesservice.asmx
  // ************************************************************************ //
  SalesServiceSoap = interface(IInvokable)
  ['{396126E1-AD85-AECB-491F-8E2880413151}']

    // Header: WebLogin:pIn
    function DealerInformationPerVehicle(const vehicleNumber: string): DealerInformationModel; stdcall;

    // Header: WebLogin:pIn
    function EquipmentPerVehicle(const vehicleNumber: string): ArrayOfEquipmentModel; stdcall;

    // Header: WebLogin:pIn
    function PaymentConditions(const vehicleNumber: string): ArrayOfPaymentConditionModel; stdcall;

    // Header: WebLogin:pIn
    function CompleteVehicleInformation(const vehicleNumber: string): CompleteVehicleInformationModel; stdcall;
  end;

function GetSalesServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SalesServiceSoap;
Aufruf im Program
Delphi-Quellcode:
var
myService : SalesServiceSoap;
myLogin : WebLogin;
myInfo : CompleteVehicleInformationModel;
myEquipment : ArrayOfEquipmentModel;

begin
 myService := GetSalesServiceSoap();
 myLogin := WebLogin.Create;
 myLogin.User := edt1.Text;
 myLogin.Password := edt2.Text;
 myLogin.Language := 1;
 myInfo := myService.CompleteVehicleInformation(edt3.text); // <= hier kommt der Fehler!
...
Was mach ich falsch?

Geändert von Blackpit (15. Jan 2020 um 15:32 Uhr)
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: Problem beim SOAP Abruf

  Alt 15. Jan 2020, 14:23
Hallo,
laut dem hier
https://entwickler-forum.de/forum/ar...9-soap-problem
liegt es an einem NIL-Pointer

Du benutzt das WebLogin-Objekt (den SOAP-Header) ja auch gar nicht.
Schau mal hier http://docwiki.embarcadero.com/RADSt...g_SOAP_Headers.
Heiko

Geändert von hoika (15. Jan 2020 um 14:26 Uhr)
  Mit Zitat antworten Zitat
Blackpit

Registriert seit: 27. Feb 2019
77 Beiträge
 
#3

AW: Problem beim SOAP Abruf

  Alt 15. Jan 2020, 15:37
...

Du benutzt das WebLogin-Objekt (den SOAP-Header) ja auch gar nicht.
Schau mal hier http://docwiki.embarcadero.com/RADSt...g_SOAP_Headers.
War ein Kopierfehler (oben korrigiert), ich benutze es schon. Den Link kannte ich auch schon, es sind auch alle Parameter gefüllt.
Wie, ausser mit WireShark o.a., kann ich hier debuggen?
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#4

AW: Problem beim SOAP Abruf

  Alt 15. Jan 2020, 16:02
Hallo,
hm, wo genau benutzt Du den Header?

http://docwiki.embarcadero.com/RADSt...t_Applications

Meines Erachtens fehlt ein

Delphi-Quellcode:
  
(myService as ISOAPHeaders).Send(myLogin); { add the header to outgoing message }
vor dem
Delphi-Quellcode:
  
  myInfo := myService.CompleteVehicleInformation(edt3.text);
Heiko
  Mit Zitat antworten Zitat
Blackpit

Registriert seit: 27. Feb 2019
77 Beiträge
 
#5

AW: Problem beim SOAP Abruf

  Alt 15. Jan 2020, 16:32
Hallo Heiko,

ich denke auch das hier der Hund begraben ist.
Dein Vorschlag läuft durch, ändert aber leider nichts am Problem.

Geändert von Blackpit (15. Jan 2020 um 16:48 Uhr)
  Mit Zitat antworten Zitat
Blackpit

Registriert seit: 27. Feb 2019
77 Beiträge
 
#6

AW: Problem beim SOAP Abruf

  Alt 15. Jan 2020, 19:10
Ich komm nicht weiter, deshalb nochmals die Frage:
...Wie, ausser mit WireShark o.a., kann ich hier debuggen?
Danke im Voraus!
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#7

AW: Problem beim SOAP Abruf

  Alt 15. Jan 2020, 20:26
Hallo,
zeig doch noch mal den geänderten Code.
Und bitte nicht im alten Post ändern, sondern hier neu reinstellen.
Heiko
  Mit Zitat antworten Zitat
Blackpit

Registriert seit: 27. Feb 2019
77 Beiträge
 
#8

AW: Problem beim SOAP Abruf

  Alt 16. Jan 2020, 10:04
Delphi-Quellcode:
procedure TForm3.btn1Click(Sender: TObject);
var
myService : SalesServiceSoap;
myLogin : WebLogin;
myDealer : DealerInformationModel;
myInfo : CompleteVehicleInformationModel;
myEquipment : ArrayOfEquipmentModel;
//myHeader : ISOAPHeaders;

begin
 myService := GetSalesServiceSoap();
 myLogin := WebLogin.Create;
 myLogin.User := edt1.Text;
 myLogin.Password := edt2.Text;
 myLogin.Language := 1;
 //myHeader := myService as ISOAPHeaders;
 //myHeader.Send(myLogin); { add the header to outgoing message }
 (myService as ISOAPHeaders).Send(myLogin); { add the header to outgoing message }
 myInfo := myService.CompleteVehicleInformation(edt3.text);
 myEquipment := myService.CompleteVehicleInformation(edt3.text).Equipment;
end;
end;
Läuft durch,der Fehler bleibt

Geändert von Blackpit (16. Jan 2020 um 12:39 Uhr) Grund: fehlende Zeile ergänzt
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#9

AW: Problem beim SOAP Abruf

  Alt 16. Jan 2020, 10:47
Hallo,
myInfo := myService.CompleteVehicleInformation(edt3.text);
myEquipment := myService.CompleteVehicleInformation(edt3.text).Eq uipment;

in welcher der beiden Zeilen?

BTW:
myEquipment := myService.CompleteVehicleInformation(edt3.text).Eq uipment;
macht für mich erst mal keinen Sinn.
Ich könnte ja gleich
myInfo..Equipment;
benutzen
Heiko
  Mit Zitat antworten Zitat
Blackpit

Registriert seit: 27. Feb 2019
77 Beiträge
 
#10

AW: Problem beim SOAP Abruf

  Alt 16. Jan 2020, 12:20
Es ist alles beim alten, myinfo ist die komplette Fahrzeuginfo, der Rest sind Teilbereiche im Service abrufbar.
Ich suche jetzt einen Weg das Protokol auszulesen, der Service funktioniert grundsätzlich per SoapUI.
Ich würde es gerne verstehen.

Geändert von Blackpit (16. Jan 2020 um 12:44 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz