Импорт WDSL в Delphi 2007 работает нормально, но генерирует предупреждение Cannot Unwrap (фрагмент кода 1, ниже [как другой вопрос, уже зарегистрированный в StackOverFlow]).
Однако, как мы устанавливаем заголовки (REQUESTOR:pIn, REQUEST_USER:pIn, REQUEST_PASSWORD:pIn)
, это не ясно из сгенерированного кода. В Интернете мы также попробовали использовать утилиту командной строки WDSLImp
, которая позволила нам использовать переключатели, например, для развертывания литералов. Нет хорошо.
Фрагмент 2 показывает материал инициализации, который мы неоднократно пытались заменить действительными значениями трех параметров заголовка. Конечный результат должен появиться через интерфейс, как этот фрагмент 3.
Вся помощь очень ценится.
Фрагмент 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's 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;
Фрагмент 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');
Фрагмент 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>