![]() |
Webservice
Servus,
ich bin neu hier und habe erst vor kurzem mit Delphi 6 begonnen. Jetzt habe ich die Aufgabe einen Webservice zu erstellen. Die dazugehörige WSDL Datei habe ich vom Kunden bekommen. Über SOAP UI habe ich die WSDL schon eingebunden, da bekomme ich eine Antwort mit der entsprechenden Anfrage. Allerdings bekomme ich im Delphi bei Ausführung ständig die FM: Object reference not set to an instance of an object! Wer hat eine Idee woran das liegen könnt? Wer das löst bekommt was von mir, ohne Witz!! Viele Grüße Sebastian Delphi-Code in der Main.pas:
Delphi-Quellcode:
Delphi-Code der WSDL:
private
{ Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; sResult:ILot; Response:String; implementation {$R *.dfm} var ToolCode:string; CheckSlotPos:boolean; EquipmentValidation:boolean; LotName:string; ReturnBrokenWafers:boolean; UseSlotPosition:boolean; procedure TForm1.Button1Click(Sender: TObject); begin // HTTPRIO1 := THTTPRIO.Create(nil); // ToolCode:='1ELAM3'; // CheckSlotPos:= false; // EquipmentValidation:=false; // LotName:='R173419P'; //ReturnBrokenWafers:=true; //UseSlotPosition:=false; //HTTPRIO1.WSDLLocation:= 'C:\SebastianBihn\Lot\Test\Lot.xml'; HTTPRIO1.URL := 'http://tst-rbg14:8019/Lot.svc'; HTTPRIO1.Service := 'Lot'; HTTPRIO1.Port := 'BasicHttpBinding_ILot'; //HTTPRIO1.URL:='http://tst-rbg14:8019/Lot.svc'; //sResult:= // sResult:=(HTTPRIO1 as ILot); (HTTPRIO1 as ILot).GetLotInfoByLotName(ToolCode,CheckSlotPos,EquipmentValidation,LotName,ReturnBrokenWafers,UseSlotPosition); //SBHTTPRIO1 := THTTPRIO.Create(nil); //Memo1.Lines.Text:= sResult; end; end.
Code:
// ************************************************************************ //
// Die in dieser Datei deklarierten Typen wurden aus Daten generiert, die aus // unten beschriebener WSDL-Datei stammen: // WSDL : C:\SebastianBihn\Lot\Test\Lot.xml // >Importieren : http://tst-rbg14:8019/Lot.svc?wsdl=wsdl0 // Codieren : utf-8 // Version : 1.0 // (25.04.2018 09:21:01 - $Revision: 1.9.1.0.1.0.1.9 $) // ************************************************************************ // unit Lot; interface uses InvokeRegistry, Types, XSBuiltIns; type ToolCode=string; CheckSlotPos=boolean; EquipmentValidation=boolean; LotName=string; ReturnBrokenWafers=boolean; UseSlotPosition=boolean; GetLotInfoByLotNameResponse =string; // ************************************************************************ // // 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 in diesem Dokument nicht deklariert (!). Die Typen aus letzterer Kategorie // sind normalerweise mit vordefinierten/bekannten XML- oder Borland-Typen verbunden; sie könnten aber auch ein Anzeichen // für ein falsches WSDL-Dokument sein, das einen Schema-Typ nicht deklariert oder importiert.. // ************************************************************************ // // !:GetLotInfoByLotName - "http://cim.osram.ws.gefasoft.com/" // !:GetLotInfoByLotNameResponse - "http://cim.osram.ws.gefasoft.com/" // !:GetLotByName - "http://cim.osram.ws.gefasoft.com/" // !:GetLotByNameResponse - "http://cim.osram.ws.gefasoft.com/" // !:HoldLot - "http://cim.osram.ws.gefasoft.com/" // !:HoldLotResponse - "http://cim.osram.ws.gefasoft.com/" // !:SplitLotByGravure - "http://cim.osram.ws.gefasoft.com/" // !:SplitLotByGravureResponse - "http://cim.osram.ws.gefasoft.com/" // !:SplitLotByGravureWorkflow - "http://cim.osram.ws.gefasoft.com/" // !:SplitLotByGravureWorkflowResponse - "http://cim.osram.ws.gefasoft.com/" // !:SplitLotByNameWorkflow - "http://cim.osram.ws.gefasoft.com/" // !:SplitLotByNameWorkflowResponse - "http://cim.osram.ws.gefasoft.com/" // !:ComposeLot - "http://cim.osram.ws.gefasoft.com/" // !:ComposeLotResponse - "http://cim.osram.ws.gefasoft.com/" // !:GetGroupByLot - "http://cim.osram.ws.gefasoft.com/" // !:GetGroupByLotResponse - "http://cim.osram.ws.gefasoft.com/" // !:MergeLot - "http://cim.osram.ws.gefasoft.com/" // !:MergeLotResponse - "http://cim.osram.ws.gefasoft.com/" // !:AssignLotToEquipmentPort - "http://cim.osram.ws.gefasoft.com/" // !:AssignLotToEquipmentPortResponse - "http://cim.osram.ws.gefasoft.com/" // ************************************************************************ // // Namespace : http://cim.osram.ws.gefasoft.com/ // binding : BasicHttpBinding_ILot // Service : Lot // Port : BasicHttpBinding_ILot // URL : http://tst-rbg14:8019/Lot.svc // ************************************************************************ // ILot = interface(IInvokable) ['{1E7F22BE-D470-57BE-AF25-CBAC66BA2E10}'] function GetLotInfoByLotName(ToolCode:string;CheckSlotPos:boolean;EquipmentValidation:boolean;LotName:string;ReturnBrokenWafers:boolean; UseSlotPosition:boolean): GetLotInfoByLotNameResponse; stdcall; // function GetLotInfoByLotName(ToolCode, CheckSlotPos): GetLotInfoByLotNameResponse; stdcall; // function GetLotByName(const parameters: GetLotByName): GetLotByNameResponse; stdcall; // function HoldLot(const parameters: HoldLot): HoldLotResponse; stdcall; // function SplitLotByGravure(const parameters: SplitLotByGravure): SplitLotByGravureResponse; stdcall; // function SplitLotByGravureWorkflow(const parameters: SplitLotByGravureWorkflow): SplitLotByGravureWorkflowResponse; stdcall; // function SplitLotByNameWorkflow(const parameters: SplitLotByNameWorkflow): SplitLotByNameWorkflowResponse; stdcall; // function ComposeLot(const parameters: ComposeLot): ComposeLotResponse; stdcall; // function GetGroupByLot(const parameters: GetGroupByLot): GetGroupByLotResponse; stdcall; // function MergeLot(const parameters: MergeLot): MergeLotResponse; stdcall; // function AssignLotToEquipmentPort(const parameters: AssignLotToEquipmentPort): AssignLotToEquipmentPortResponse; stdcall; end; function GetILot(UseWSDL: Boolean=System.false; Addr: string=''): ILot; implementation uses SOAPHTTPClient; function GetILot(UseWSDL: Boolean; Addr: string): ILot; const defWSDL = 'C:\SebastianBihn\Lot\Test\Lot.xml'; defURL = 'http://tst-rbg14:8019/Lot.svc'; defSvc = 'Lot'; defPrt = 'BasicHttpBinding_ILot'; var HTTPRIO1: THTTPRIO; begin Result := nil; if (Addr = '') then begin if UseWSDL then Addr := defWSDL else Addr := defURL; end; HTTPRIO1 := THTTPRIO.Create(nil); try if UseWSDL then begin HTTPRIO1.WSDLLocation := Addr; HTTPRIO1.Service := defSvc; HTTPRIO1.Port := defPrt; end else HTTPRIO1.URL := Addr; Result := (HTTPRIO1 as ILot); finally if Result = nil then HTTPRIO1.Free; end; end; initialization InvRegistry.RegisterInterface(TypeInfo(ILot), 'http://cim.osram.ws.gefasoft.com/', 'UTF-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ILot), 'http://cim.osram.ws.gefasoft.com/ILot/GetLotInfoByLotName'); // InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ILot), ''); InvRegistry.RegisterInvokeOptions(TypeInfo(ILot), ioDocument); end. |
AW: Webservice
Delphi-Quellcode:
Was gibt es denn?
var
Form1: TForm1; sResult: ILot; implementation {$R *.dfm} var ToolCode: string; CheckSlotPos: Boolean; EquipmentValidation: Boolean; LotName: string; ReturnBrokenWafers: Boolean; UseSlotPosition: Boolean; procedure TForm1.Button1Click(Sender: TObject); var URL: string; Response: GetLotInfoByLotNameResponse; begin URL := 'http://tst-rbg14:8019/Lot.svc'; if not Assigned(sResult) then sResult := GetILot(False, URL); Response := sResult.GetLotInfoByLotName(ToolCode, CheckSlotPos, EquipmentValidation, LotName, ReturnBrokenWafers, UseSlotPosition); if Response <> '' then ShowMessage(Response); end; |
AW: Webservice
Also nen Kasten Bier in Form von Geld auf jeden Fall.
Aber bis jetzt bekomme ich immer noch diese komische Fehlermeldung!!?? |
AW: Webservice
So sieht der Code im SOAP aus, also im XML-Format. Das ist die Anforderung. Ich muss mich bei diesem Server erst mit einem Zertifikat anmelden. Weiß nicht ob das irgendeine Bewandtnis hat.
Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cim="http://cim.osram.ws.gefasoft.com/" xmlns:dat="http://cim.osram.ws.gefasoft.com/DataContracts">
<soapenv:Header/> <soapenv:Body> <cim:GetLotInfoByLotName> <!--Optional:--> <cim:requestMessage> <dat:ToolCode>?</dat:ToolCode> <!--Optional:--> <dat:CheckSlotPos>false</dat:CheckSlotPos> <!--Optional:--> <dat:EquipmentValidation>false</dat:EquipmentValidation> <!--Optional:--> <dat:LotName>R173419P</dat:LotName> <!--Optional:--> <dat:ReturnBrokenWafers>true</dat:ReturnBrokenWafers> <!--Optional:--> <dat:UseSlotPosition>false</dat:UseSlotPosition> </cim:requestMessage> </cim:GetLotInfoByLotName> </soapenv:Body> </soapenv:Envelope> |
AW: Webservice
Die Daten, die du reinsteckst, sind eventuell fehlerhaft und/oder unvollständig.
|
AW: Webservice
Okay,
ja das ist das große Problem, aber an der WSDL-Datei müsste eigentlich alles okay sein!? Die habe ich ja von Osram bekommen. Musste aber Anpassungen machen. Aber für den Request brauche ich 6 Parameter, die sehe ich im SOAP und da bekommen ich auch eine Antwort. Nur eben im Delphi nicht. Vielleicht hast du noch eine Idee, wie ich die Parameter übergeben kann. Viele Grüße. |
AW: Webservice
Delphi 6?
Besorg dir mal eine neue Delphi-Version. Diese antike Version hat noch sehr viele Macken/Problem/Fehler im Berech SOAP/Webservices. Und von Zertifikaten und Authentifizierungen hat diese Delphi-Version überhaupt noch nicht unterstützt. |
AW: Webservice
Hallo,
klar kann das Delphi6, aber nur mit Hilfe der Indys. |
AW: Webservice
Guten Morgen,
@ Heiko Was sind denn die Indies und wo bekomme ich die her? @Bernhard ja das sehe ich genau so, allerdings ist die GUI einer Maschine von uns in dieser Version erstellt. Ich habe erst vor kurzem angefangen und soll jetzt das bestehende System an einen Webserver anbinden. Aber mal so rum gefragt, in wie weit kann ich alte Projekte hochkonvertieren, also upgraden?! Vielen Dank für die Info. Grüße Sebastian |
AW: Webservice
Indy ist Teil von Delphi oder über
![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:45 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz