Java 呼叫代碼
采用 axis2,代碼如下:
HTSAPServerServiceStub stub = new HTSAPServerServiceStub(
"http://IP:PORT/HTServer/services/HTSAPServer");
HTSAPServerServiceStub.LoginE login8 =
(HTSAPServerServiceStub.LoginE)
getTestObject(HTSAPServerServiceStub.LoginE.class);
Login l = new Login();
l.setStrDeviceId("設備編號");
l.setStrDeviceKey("密鑰");
login8.setLogin(l);
LoginResponseE le = stub.login(login8);
LoginResponse lr = le.getLoginResponse();
String msg = lr.get_return();
轉delphi的代碼
uj5u.com熱心網友回復:
需要知道 HTSAPServerServiceStub 登錄里做了什么才可以轉,可以有三種解決思路:1、直接借助http工具抓包,分析下登錄報文及回傳;
2、java 登錄相關程式反編譯,分析下 HTSAPServerServiceStub 做了什么;
3、設備端的登錄介面檔案,然后依據檔案實作;
Delphi 實作HttpClient,可以用 IdHttp組件
uj5u.com熱心網友回復:
typeloginResponse = class; { "http://server.cdt.com" }
login = class; { "http://server.cdt.com" }
login = class(TRemotable)
private
FstrDeviceId: WideString;
FstrDeviceKey: WideString;
published
property strDeviceId: WideString read FstrDeviceId write FstrDeviceId;
property strDeviceKey: WideString read FstrDeviceKey write FstrDeviceKey;
end;
HTSAPServer = interface(IInvokable)
function 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');
///下面呼叫login函式出錯,誰幫助寫一下怎么呼叫?
procedure TForm1.btn1Click(Sender: TObject);
var
lginRse:loginResponse ;
login1:login;
begin
login1:=login.Create ;
lginRse:=loginResponse.Create ;
login1.strDeviceId :='123456' ;
login1.strDeviceKey :='1234567890' ;
try
lginRse:=(htpr1 as HTSAPServer).login(login1) ;
mmo1.Text :=lginRse.return ;
finally
login1.Free ;
lginRse.Free ;
end;
end;
///回傳 :XML檔案必須有一個頂層元素 好像HTSAPServerServiceStub只是頂層元數,無意義,我想只上面的代碼加一層頂層元素試試,不知怎么加。
uj5u.com熱心網友回復:
不要去跟代碼了,直接查看發包的內容引數然后用http的post函式構造就可以了
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/19251.html
標籤:語言基礎/算法/系統設計
上一篇:FDMemTable.post 出錯“[FireDAC][DApt]-402.Operation cannot be performed without ass
