자유롭게 질의 및 응답을 할 수 있는 게시판입니다. 개발자 여러분의 답변이 큰 도움이 됩니다.
- 제품설치/등록 오류 문의: 설치/등록 Q&A 이용 (제품 구매 고객 한정)
Delphi WSDL 함수 호출
2020.08.26 14:16
본 게시판은 개발자들이 자유롭게 질문과 답변을 공유하는 게시판입니다.
* 따라서 최대한 정중하게 질문을 올려 주세요.
* 질문을 상세히 작성해 주실 수록 좋은 답변이 올라 옵니다.
* 다른 분들도 참고할 수 있도록 결과 댓글 필수(또는 감사 댓글)
(결과 댓글을 달지 않는 경우 다음 질문에 대한 답변이 달리지 않는 불이익이 있을 수 있습니다.)
-----------------------------------------------------------------------------------------------
이 분야 첨 해보다 보내 자료검색 쉽지 않고 , 아직 익숙하지 않네요 삽질하다가 문의드립니다.
- WSDL를 Import했습니다.(아래 파일텍스트 참조)
기본내용은 id.pw,변수 설정하고 xml로 호출하고 xml로 응답을 받는 건데 변수설정과 호출을 어떻게 하는지 잘 되지 않네요
해결하는데 좋은 답변을 주신분에게 스타벅스 한잔쏘겠습니다. 이걸로 충분할지는 모르겠지만.
=========================================================파일시작
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://127.0.0.1:10080/apex/services/zzgobasicservice?wsdl
// >Import : http://127.0.0.1:10080/apex/services/zzgobasicservice?wsdl>0
// Encoding : UTF-8
// Version : 1.0
// (2020-08-25 오후 04:55:56 - - $Rev: 98209 $)
// ************************************************************************ //
unit zzgobasicservice;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_REF = $0080;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
basicInvokeResponse = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
invokeRequest = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
invokeResponse = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
basicInvoke = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
// ************************************************************************ //
// XML : basicInvokeResponse, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
basicInvokeResponse = class(TRemotable)
private
FbasicInvokeResponse: string;
public
constructor Create; override;
published
property basicInvokeResponse: string read FbasicInvokeResponse write FbasicInvokeResponse;
end;
// ************************************************************************ //
// XML : invokeRequest, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
invokeRequest = class(TRemotable)
private
FscopeCoordinateIds: string;
Frequest: string;
Fhandler: string;
Flocale: string;
public
constructor Create; override;
published
property scopeCoordinateIds: string read FscopeCoordinateIds write FscopeCoordinateIds;
property request: string read Frequest write Frequest;
property handler: string read Fhandler write Fhandler;
property locale: string read Flocale write Flocale;
end;
// ************************************************************************ //
// XML : invokeResponse, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
invokeResponse = class(TRemotable)
private
FbasicInvokeResponse: string;
public
constructor Create; override;
published
property basicInvokeResponse: string read FbasicInvokeResponse write FbasicInvokeResponse;
end;
// ************************************************************************ //
// XML : basicInvoke, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
basicInvoke = class(TRemotable)
private
FscopeCoordinateIds: string;
FxmlDoc: string;
public
constructor Create; override;
published
property scopeCoordinateIds: string read FscopeCoordinateIds write FscopeCoordinateIds;
property xmlDoc: string read FxmlDoc write FxmlDoc;
end;
// ************************************************************************ //
// Namespace : http://localhost/services/zzgobasicservice
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// use : literal
// binding : ArgobasicServiceSoapBinding
// service : ArgobasicService
// port : ArgobasicServicePort
// URL : http://127.0.0.1:10080/apex/services/zzgobasicservice
// ************************************************************************ //
ArgobasicServicePort = interface(IInvokable)
['{195B1121-9A85-841B-0098-0BFC35679FC7}']
function basicInvoke(const basicInvoke: basicInvoke): basicInvokeResponse; stdcall;
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
function invoke(const invokeRequest: invokeRequest): invokeResponse; stdcall;
end;
function GetArgobasicServicePort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ArgobasicServicePort;
implementation
uses System.SysUtils;
function GetArgobasicServicePort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ArgobasicServicePort;
const
defWSDL = 'http://127.0.0.1:10080/apex/services/zzgobasicservice?wsdl';
defURL = 'http://127.0.0.1:10080/apex/services/zzgobasicservice';
defSvc = 'ArgobasicService';
defPrt = 'ArgobasicServicePort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as ArgobasicServicePort);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
constructor basicInvokeResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor invokeRequest.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor invokeResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor basicInvoke.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
initialization
{ ArgobasicServicePort }
InvRegistry.RegisterInterface(TypeInfo(ArgobasicServicePort), 'http://localhost/services/zzgobasicservice', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ArgobasicServicePort), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(ArgobasicServicePort), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(ArgobasicServicePort), ioLiteral);
RemClassRegistry.RegisterXSClass(basicInvokeResponse, 'http://localhost/services/zzgobasicservice', 'basicInvokeResponse');
RemClassRegistry.RegisterSerializeOptions(basicInvokeResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(invokeRequest, 'http://localhost/services/zzgobasicservice', 'invokeRequest');
RemClassRegistry.RegisterSerializeOptions(invokeRequest, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(invokeResponse, 'http://localhost/services/zzgobasicservice', 'invokeResponse');
RemClassRegistry.RegisterSerializeOptions(invokeResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(basicInvoke, 'http://localhost/services/zzgobasicservice', 'basicInvoke');
RemClassRegistry.RegisterSerializeOptions(basicInvoke, [xoLiteralParam]);
end.
===================파일 끝
Delphi WSDL 함수 호출
2020.08.26 14:16
본 게시판은 개발자들이 자유롭게 질문과 답변을 공유하는 게시판입니다.
* 따라서 최대한 정중하게 질문을 올려 주세요.
* 질문을 상세히 작성해 주실 수록 좋은 답변이 올라 옵니다.
* 다른 분들도 참고할 수 있도록 결과 댓글 필수(또는 감사 댓글)
(결과 댓글을 달지 않는 경우 다음 질문에 대한 답변이 달리지 않는 불이익이 있을 수 있습니다.)
-----------------------------------------------------------------------------------------------
이 분야 첨 해보다 보내 자료검색 쉽지 않고 , 아직 익숙하지 않네요 삽질하다가 문의드립니다.
- WSDL를 Import했습니다.(아래 파일텍스트 참조)
기본내용은 id.pw,변수 설정하고 xml로 호출하고 xml로 응답을 받는 건데 변수설정과 호출을 어떻게 하는지 잘 되지 않네요
해결하는데 좋은 답변을 주신분에게 스타벅스 한잔쏘겠습니다. 이걸로 충분할지는 모르겠지만.
=========================================================파일시작
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://127.0.0.1:10080/apex/services/zzgobasicservice?wsdl
// >Import : http://127.0.0.1:10080/apex/services/zzgobasicservice?wsdl>0
// Encoding : UTF-8
// Version : 1.0
// (2020-08-25 오후 04:55:56 - - $Rev: 98209 $)
// ************************************************************************ //
unit zzgobasicservice;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_REF = $0080;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
basicInvokeResponse = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
invokeRequest = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
invokeResponse = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
basicInvoke = class; { "http://localhost/services/zzgobasicservice"[Lit][GblElm] }
// ************************************************************************ //
// XML : basicInvokeResponse, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
basicInvokeResponse = class(TRemotable)
private
FbasicInvokeResponse: string;
public
constructor Create; override;
published
property basicInvokeResponse: string read FbasicInvokeResponse write FbasicInvokeResponse;
end;
// ************************************************************************ //
// XML : invokeRequest, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
invokeRequest = class(TRemotable)
private
FscopeCoordinateIds: string;
Frequest: string;
Fhandler: string;
Flocale: string;
public
constructor Create; override;
published
property scopeCoordinateIds: string read FscopeCoordinateIds write FscopeCoordinateIds;
property request: string read Frequest write Frequest;
property handler: string read Fhandler write Fhandler;
property locale: string read Flocale write Flocale;
end;
// ************************************************************************ //
// XML : invokeResponse, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
invokeResponse = class(TRemotable)
private
FbasicInvokeResponse: string;
public
constructor Create; override;
published
property basicInvokeResponse: string read FbasicInvokeResponse write FbasicInvokeResponse;
end;
// ************************************************************************ //
// XML : basicInvoke, global, <element>
// Namespace : http://localhost/services/zzgobasicservice
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
basicInvoke = class(TRemotable)
private
FscopeCoordinateIds: string;
FxmlDoc: string;
public
constructor Create; override;
published
property scopeCoordinateIds: string read FscopeCoordinateIds write FscopeCoordinateIds;
property xmlDoc: string read FxmlDoc write FxmlDoc;
end;
// ************************************************************************ //
// Namespace : http://localhost/services/zzgobasicservice
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// use : literal
// binding : ArgobasicServiceSoapBinding
// service : ArgobasicService
// port : ArgobasicServicePort
// URL : http://127.0.0.1:10080/apex/services/zzgobasicservice
// ************************************************************************ //
ArgobasicServicePort = interface(IInvokable)
['{195B1121-9A85-841B-0098-0BFC35679FC7}']
function basicInvoke(const basicInvoke: basicInvoke): basicInvokeResponse; stdcall;
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
function invoke(const invokeRequest: invokeRequest): invokeResponse; stdcall;
end;
function GetArgobasicServicePort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ArgobasicServicePort;
implementation
uses System.SysUtils;
function GetArgobasicServicePort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ArgobasicServicePort;
const
defWSDL = 'http://127.0.0.1:10080/apex/services/zzgobasicservice?wsdl';
defURL = 'http://127.0.0.1:10080/apex/services/zzgobasicservice';
defSvc = 'ArgobasicService';
defPrt = 'ArgobasicServicePort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as ArgobasicServicePort);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
constructor basicInvokeResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor invokeRequest.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor invokeResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor basicInvoke.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
initialization
{ ArgobasicServicePort }
InvRegistry.RegisterInterface(TypeInfo(ArgobasicServicePort), 'http://localhost/services/zzgobasicservice', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ArgobasicServicePort), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(ArgobasicServicePort), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(ArgobasicServicePort), ioLiteral);
RemClassRegistry.RegisterXSClass(basicInvokeResponse, 'http://localhost/services/zzgobasicservice', 'basicInvokeResponse');
RemClassRegistry.RegisterSerializeOptions(basicInvokeResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(invokeRequest, 'http://localhost/services/zzgobasicservice', 'invokeRequest');
RemClassRegistry.RegisterSerializeOptions(invokeRequest, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(invokeResponse, 'http://localhost/services/zzgobasicservice', 'invokeResponse');
RemClassRegistry.RegisterSerializeOptions(invokeResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(basicInvoke, 'http://localhost/services/zzgobasicservice', 'basicInvoke');
RemClassRegistry.RegisterSerializeOptions(basicInvoke, [xoLiteralParam]);
end.
===================파일 끝
자답]
삽질하다 해외사이트에 유사한 내용이 있어 참조하니 되네요
Rio := THTTPRIO.Create(nil);
HTTPReqResp1 := THTTPReqResp.create(nil);
Rio.WSDLLocation := Addr;
HTTPReqResp1.UserName:= id;
HTTPReqResp1.Password:= pw;
Rio.HTTPWebNode := HTTPReqResp1;
Req := InvokeRequest.Create;
Req.scopeCoordinateIds := Scope;
Req.request := RequestXML;
// EXECUTION
ResponseXML := argobasicservice.GetArgobasicServicePort(True,'',Rio).invoke(Req).basicInvokeResponse;