在Delphi 2007中导入WDSL工作正常,但会生成一个无法解开警告(下面的代码片段1 [就像已经登录StackOverFlow的另一个问题])。
但是,我们如何设置从生成的代码中不清楚的标题(REQUESTOR:pIn, REQUEST_USER:pIn, REQUEST_PASSWORD:pIn)
。在网上寻找其他地方,我们也尝试了命令行utilitiy 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>