Home > Back-end >  Java turn Delphi code how to turn
Java turn Delphi code how to turn

Time:11-07

Java calling code
With axis2, the code is as follows:
HTSAPServerServiceStub stub=new HTSAPServerServiceStub (
"Http://IP:PORT/HTServer/services/HTSAPServer");
HTSAPServerServiceStub. LoginE login8=
(HTSAPServerServiceStub LoginE)
GetTestObject (HTSAPServerServiceStub LoginE. Class);
The Login l=new Login ();
L.s etStrDeviceId (" equipment serial number ");
L.s etStrDeviceKey (" key ");
Login8. SetLogin (l);
LoginResponseE le=stub. Login (login8);
LoginResponse lr=le. GetLoginResponse ();
String MSG=lr. Get_return ();

Delphi code

CodePudding user response:

Need to know HTSAPServerServiceStub login in what can turn, can have three kinds of solution:
1. With the tools of HTTP directly caught, analysis the login message and returns;
2, Java login relevant procedure decompiling, analysis of what has been done for the HTSAPServerServiceStub;
Login interface document 3, the device, and then based on document implementation;

Delphi realize HttpClient, can use IdHttp components

CodePudding user response:

Type

LoginResponse=class; {" http://server.cdt.com "}
The login=class; {" http://server.cdt.com "}


The login=class (TRemotable)
Private
FstrDeviceId: WideString;
FstrDeviceKey: WideString;
Published
The property strDeviceId: WideString read FstrDeviceId write FstrDeviceId;
The property strDeviceKey: WideString read FstrDeviceKey write FstrDeviceKey;
end;


HTSAPServer=interface (IInvokable)

Function the login (const parameters: login) : loginResponse. Stdcall;


Initialization
InvRegistry. RegisterInterface (TypeInfo (HTSAPServer), 'http://server.cdt.com', 'utf-8');
InvRegistry. RegisterInvokeOptions (TypeInfo (HTSAPServer), ioDocument);//jia
InvRegistry. RegisterDefaultSOAPAction (TypeInfo (HTSAPServer), ");
RemClassRegistry. RegisterXSClass (login, 'http://server.cdt.com', 'login');

///call the login function below error, who helped write down how to call?

Procedure TForm1. Btn1Click (Sender: TObject);
Var

LginRse: loginResponse;
Login1: login;

The begin

Login1:=login. Create;
LginRse:=loginResponse. Create;

Login1. StrDeviceId:='123456';
Login1. StrDeviceKey:='1234567890';
Try
LginRse:=(htpr1 as HTSAPServer). The login (login1);
Mmo1. Text:=lginRse. Return;
The finally
Login1. Free;
LginRse. Free;
end;


end;
///return: XML document must have a top-level elements like HTSAPServerServiceStub yuan number on top of just and meaningless, I think only the code above to add a layer of top-level elements try, don't know how to add,

CodePudding user response:

Don't go with code, directly to the content of the contract parameters
Then use the HTTP post function structure can the
  • Related