Delphi 2007 WSDL Import, customizing SOAP header information

Importing WDSL in Delphi 2007 works fine, but generates a Can not Unwrap warning (code snippet 1 below [as another question already recorded in StackOverFlow]).

However, how do we set the headers (REQUESTOR:pIn, REQUEST_USER:pIn, REQUEST_PASSWORD:pIn) , which are unclear from the generated code. Elsewhere on the Web, we also tried the WDSLImp command-line WDSLImp , which allowed us to use switches, for example, to deploy literals. Not good.

Fragment 2 shows the initialization elements that we tried differently to substitute real values ​​for the three header parameters. The end result should appear on an interface similar to this fragment 3.

All help is much appreciated.

Fragment 1:

 // ************************************************************************ // // Namespace : http//www.sx3.com/GET_SERVICE_STATUS.wsdl // soapAction: https//xxx.org.uk:23105/communication/gateway // transport : http//schemas.xmlsoap.org/soap/http // style : document // binding : UpdGetServiceStatusBinding // service : UpdGetServiceStatusService // port : UpdGetServiceStatusPort // URL : http//machine:port/communication/UpdGetServiceStatus // ************************************************************************ // UpdGetServiceStatusPort = interface(IInvokable) ['{CB3F81D1-5267-4897-C244-288E348AA34E}'] // Cannot unwrap: // - Input element wrapper name does not match operation name // - More than one strictly out element was found // Headers: REQUESTOR:pIn, REQUEST_USER:pIn, REQUEST_PASSWORD:pIn function UpdGetServiceStatus(const parameters: GetServiceStatusRequest): GET_SERVICE_STATUS; stdcall; end; function GetUpdGetServiceStatusPort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): UpdGetServiceStatusPort; implementation uses SysUtils; function GetUpdGetServiceStatusPort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): UpdGetServiceStatusPort; const defWSDL = 'get_service_status_net.wsdl'; defURL = 'http//machine:port/communication/UpdGetServiceStatus'; defSvc = 'UpdGetServiceStatusService'; defPrt = 'UpdGetServiceStatusPort'; 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 UpdGetServiceStatusPort); 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; 

Fragment 2:

 initialization InvRegistry.RegisterInterface(TypeInfo(UpdGetServiceStatusPort), 'http//www.sx3.com/GET_SERVICE_STATUS.wsdl', 'utf-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(UpdGetServiceStatusPort), 'https//xxx.org.uk:23105/communication/gateway'); InvRegistry.RegisterInvokeOptions(TypeInfo(UpdGetServiceStatusPort), ioDocument); InvRegistry.RegisterInvokeOptions(TypeInfo(UpdGetServiceStatusPort), ioLiteral); InvRegistry.RegisterHeaderClass(TypeInfo(UpdGetServiceStatusPort), REQUESTOR, 'REQUESTOR', 'http//www.yyy.com/IntegratorCoreTypes'); InvRegistry.RegisterHeaderClass(TypeInfo(UpdGetServiceStatusPort), REQUEST_USER, 'REQUEST_USER', 'http//www.yyy.com/IntegratorCoreTypes'); InvRegistry.RegisterHeaderClass(TypeInfo(UpdGetServiceStatusPort), REQUEST_PASSWORD, 'REQUEST_PASSWORD', 'http//www.yyy.com/IntegratorCoreTypes'); InvRegistry.RegisterExternalParamName(TypeInfo(UpdGetServiceStatusPort), 'UpdGetServiceStatus', 'parameters1', 'parameters'); RemClassRegistry.RegisterXSInfo(TypeInfo(APIMessagesType), 'http//www.sx3.com/UpdGetServiceStatusResponse', 'APIMessagesType'); RemClassRegistry.RegisterXSClass(GET_SERVICE_STATUS, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'GET_SERVICE_STATUS'); RemClassRegistry.RegisterSerializeOptions(GET_SERVICE_STATUS, [xoLiteralParam]); RemClassRegistry.RegisterXSClass(GetServiceStatusRequestType, 'http//www.sx3.com/GET_SERVICE_STATUS', 'GetServiceStatusRequestType'); RemClassRegistry.RegisterSerializeOptions(GetServiceStatusRequestType, [xoLiteralParam]); RemClassRegistry.RegisterXSClass(GetServiceStatusRequest, 'http//www.sx3.com/GET_SERVICE_STATUS', 'GetServiceStatusRequest'); RemClassRegistry.RegisterXSInfo(TypeInfo(char4000), 'http://www.sx3.com/houCommonTypes', 'char4000'); RemClassRegistry.RegisterXSClass(GetServiceStatusType, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'GetServiceStatusType'); RemClassRegistry.RegisterXSInfo(TypeInfo(char25), 'http//www.sx3.com/houCommonTypes', 'char25'); RemClassRegistry.RegisterXSClass(APIMessageType, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'APIMessageType'); RemClassRegistry.RegisterXSInfo(TypeInfo(char30), 'http//www.sx3.com/houCommonTypes', 'char30'); RemClassRegistry.RegisterXSInfo(TypeInfo(char7), 'http//www.sx3.com/houCommonTypes', 'char7'); RemClassRegistry.RegisterXSClass(MESSAGEType, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGEType'); RemClassRegistry.RegisterExternalPropName(TypeInfo(MESSAGEType), 'TYPE_', 'TYPE'); RemClassRegistry.RegisterXSInfo(TypeInfo(int15), 'http//www.sx3.com/houCommonTypes', 'int15'); RemClassRegistry.RegisterXSClass(GetServiceStatusResponseType, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'GetServiceStatusResponseType'); RemClassRegistry.RegisterXSInfo(TypeInfo(RETURNED_MESSAGESType), 'http//www.sx3.com/sx3returnedmessages', 'RETURNED_MESSAGESType'); RemClassRegistry.RegisterXSClass(MESSAGE_RETURN_INFO, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGE_RETURN_INFO'); RemClassRegistry.RegisterXSClass(MESSAGE_RETURN_INFO2, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGE_RETURN_INFO2', 'MESSAGE_RETURN_INFO'); RemClassRegistry.RegisterXSClass(REQUESTOR, 'http//www.yyy.com/IntegratorCoreTypes', 'REQUESTOR'); RemClassRegistry.RegisterSerializeOptions(REQUESTOR, [xoSimpleTypeWrapper]); RemClassRegistry.RegisterXSClass(REQUEST_USER, 'http//www.yyy.com/IntegratorCoreTypes', 'REQUEST_USER'); RemClassRegistry.RegisterSerializeOptions(REQUEST_USER, [xoSimpleTypeWrapper]); RemClassRegistry.RegisterXSClass(REQUEST_PASSWORD, 'http//www.yyy.com/IntegratorCoreTypes', 'REQUEST_PASSWORD'); RemClassRegistry.RegisterSerializeOptions(REQUEST_PASSWORD, [xoSimpleTypeWrapper]); RemClassRegistry.RegisterXSClass(APIMessage, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'APIMessage'); RemClassRegistry.RegisterXSClass(MESSAGE_, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGE_', 'MESSAGE'); 

Fragment 3:

 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http//schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance" xmlns:xs="http//www.w3.org/2001/XMLSchema" xmlns:ig="http//www.yyy.com/IntegratorCoreTypes" xmlns:ng1="http//www.sx3.com/GET_WORKS_ORDERS_LIST"> <soap:Header> <ig:REQUESTOR>REALREQUESTOR</ig:REQUESTOR> <ig:REQUEST_USER>REALREQUEST_USER</ig:REQUEST_USER> <ig:REQUEST_PASSWORD>realpassword</ig:REQUEST_PASSWORD> </soap:Header> <soap:Body> <ng1:WorksOrdersListRequest/> </soap:Body> </soap:Envelope> 
+4
source share

All Articles