我正在努力导入Endicia Web服务的wsdl。 wsdl位于here。 指向Delphi中wsdl导入器中的链接会生成错误消息,提示缺少标题,因此我将wsdl下载到文件中,然后尝试加载它。在给出一些有关缺少名称空间的错误之后,我将wsdl的第一行更改为
<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:s="www.envmgr.com/LabelService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="www.envmgr.com/LabelService" xmlns:mime="www.envmgr.com/LabelService" targetNamespace="www.envmgr.com/LabelService">
现在wsdl假装要导入,但是未定义类型,方法等,结果文件看起来像这样
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : E:\PROJECTS\...\docs\Endicia\Endicia.wsdl
// (20.7.2018 00:38:04 - - $Rev: 56641 $)
// ************************************************************************ //
unit Endicia;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
type
// ************************************************************************ //
// Namespace : www.envmgr.com/LabelService
// style : ????
// use : ????
// ************************************************************************ //
EwsLabelServiceSoap = interface(IInvokable)
['{66DB4E34-CE1D-AE12-4851-584340CD72A6}']
procedure GetChallengeQuestion; stdcall;
procedure GetChallengeQuestionXML; stdcall;
procedure GetAccountStatus; stdcall;
procedure GetAccountStatusXML; stdcall;
procedure GetPostageLabel; stdcall;
procedure GetPostageLabelXML; stdcall;
procedure GetVersion; stdcall;
procedure GetVersionXML; stdcall;
procedure VoideVSLabel; stdcall;
procedure VoideVSLabelXML; stdcall;
procedure BuyPostage; stdcall;
procedure BuyPostageXML; stdcall;
procedure CalculateDdpRate; stdcall;
procedure CalculateDdpRateXML; stdcall;
procedure CalculatePostageRate; stdcall;
procedure CalculatePostageRateXML; stdcall;
procedure GetExtraServiceRates; stdcall;
procedure GetExtraServiceRatesXML; stdcall;
procedure GetPicNumber; stdcall;
procedure GetPicNumberXml; stdcall;
procedure SetAccountFeatureOptIn; stdcall;
procedure SetAccountFeatureOptInXML; stdcall;
procedure UpdatePaymentInformation; stdcall;
procedure UpdatePaymentInformationXML; stdcall;
procedure ChangePassPhrase; stdcall;
procedure ChangePassPhraseXML; stdcall;
procedure CalculatePostageRates; stdcall;
procedure CalculatePostageRatesXML; stdcall;
procedure CloseAccount; stdcall;
procedure CloseAccountXML; stdcall;
procedure CreateDhlgmManifest; stdcall;
procedure CreateDhlgmManifestXML; stdcall;
procedure HandleDHLeCManifest; stdcall;
procedure HandleDHLeCManifestXML; stdcall;
procedure StatusRequest; stdcall;
procedure StatusRequestXML; stdcall;
procedure GetRetailAccounts; stdcall;
procedure GetRetailAccountsXML; stdcall;
procedure GetUserSignUp; stdcall;
procedure GetUserSignUpXML; stdcall;
procedure GetTransactionsListing; stdcall;
procedure GetTransactionsListingXML; stdcall;
procedure GetPackagePickupChange; stdcall;
procedure GetPackagePickupChangeXML; stdcall;
procedure GetPackagePickupAvailability; stdcall;
procedure GetPackagePickupAvailabilityXML; stdcall;
procedure GetPackagePickup; stdcall;
procedure GetPackagePickupXML; stdcall;
procedure GetPackagePickupCancel; stdcall;
procedure GetPackagePickupCancelXML; stdcall;
procedure GetPostageRateTable; stdcall;
procedure GetPostageRateTableXML; stdcall;
procedure GetSCAN; stdcall;
procedure GetSCANXML; stdcall;
procedure GetRefund; stdcall;
procedure GetRefundXML; stdcall;
procedure ResetSuspendedAccount; stdcall;
procedure ResetSuspendedAccountXML; stdcall;
end;
// ************************************************************************ //
// Namespace : www.envmgr.com/LabelService
// style : ????
// use : ????
// ************************************************************************ //
EwsLabelServiceHttpGet = interface(IInvokable)
['{10654ECB-F577-1C52-4542-ED28631A015D}']
procedure GetChallengeQuestionXML; stdcall;
procedure GetAccountStatusXML; stdcall;
procedure GetPostageLabelXML; stdcall;
procedure GetVersion; stdcall;
procedure GetVersionXML; stdcall;
procedure VoideVSLabelXML; stdcall;
procedure BuyPostageXML; stdcall;
procedure CalculateDdpRateXML; stdcall;
procedure CalculatePostageRateXML; stdcall;
procedure GetExtraServiceRatesXML; stdcall;
procedure GetPicNumberXml; stdcall;
procedure SetAccountFeatureOptInXML; stdcall;
procedure UpdatePaymentInformationXML; stdcall;
procedure ChangePassPhraseXML; stdcall;
procedure CalculatePostageRatesXML; stdcall;
procedure CloseAccountXML; stdcall;
procedure CreateDhlgmManifestXML; stdcall;
procedure HandleDHLeCManifestXML; stdcall;
procedure StatusRequestXML; stdcall;
procedure GetRetailAccountsXML; stdcall;
procedure GetUserSignUpXML; stdcall;
procedure GetTransactionsListingXML; stdcall;
procedure GetPackagePickupChangeXML; stdcall;
procedure GetPackagePickupAvailabilityXML; stdcall;
procedure GetPackagePickupXML; stdcall;
procedure GetPackagePickupCancelXML; stdcall;
procedure GetPostageRateTableXML; stdcall;
procedure GetSCANXML; stdcall;
procedure GetRefundXML; stdcall;
procedure ResetSuspendedAccountXML; stdcall;
end;
// ************************************************************************ //
// Namespace : www.envmgr.com/LabelService
// style : ????
// use : ????
// ************************************************************************ //
EwsLabelServiceHttpPost = interface(IInvokable)
['{C9B70E41-CB20-6302-42E1-2F232CDDA04F}']
procedure GetChallengeQuestionXML; stdcall;
procedure GetAccountStatusXML; stdcall;
procedure GetPostageLabelXML; stdcall;
procedure GetVersion; stdcall;
procedure GetVersionXML; stdcall;
procedure VoideVSLabelXML; stdcall;
procedure BuyPostageXML; stdcall;
procedure CalculateDdpRateXML; stdcall;
procedure CalculatePostageRateXML; stdcall;
procedure GetExtraServiceRatesXML; stdcall;
procedure GetPicNumberXml; stdcall;
procedure SetAccountFeatureOptInXML; stdcall;
procedure UpdatePaymentInformationXML; stdcall;
procedure ChangePassPhraseXML; stdcall;
procedure CalculatePostageRatesXML; stdcall;
procedure CloseAccountXML; stdcall;
procedure CreateDhlgmManifestXML; stdcall;
procedure HandleDHLeCManifestXML; stdcall;
procedure StatusRequestXML; stdcall;
procedure GetRetailAccountsXML; stdcall;
procedure GetUserSignUpXML; stdcall;
procedure GetTransactionsListingXML; stdcall;
procedure GetPackagePickupChangeXML; stdcall;
procedure GetPackagePickupAvailabilityXML; stdcall;
procedure GetPackagePickupXML; stdcall;
procedure GetPackagePickupCancelXML; stdcall;
procedure GetPostageRateTableXML; stdcall;
procedure GetSCANXML; stdcall;
procedure GetRefundXML; stdcall;
procedure ResetSuspendedAccountXML; stdcall;
end;
implementation
uses SysUtils;
initialization
{ EwsLabelServiceSoap }
InvRegistry.RegisterInterface(TypeInfo(EwsLabelServiceSoap), 'www.envmgr.com/LabelService', '');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(EwsLabelServiceSoap), '');
{ EwsLabelServiceHttpGet }
InvRegistry.RegisterInterface(TypeInfo(EwsLabelServiceHttpGet), 'www.envmgr.com/LabelService', '');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(EwsLabelServiceHttpGet), '');
{ EwsLabelServiceHttpPost }
InvRegistry.RegisterInterface(TypeInfo(EwsLabelServiceHttpPost), 'www.envmgr.com/LabelService', '');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(EwsLabelServiceHttpPost), '');
end.
因此,我认为wsdl文件的格式不正确,可能我的第一行没有正确。 任何想法什么是错的以及如何解决都受到欢迎。 谢谢。
编辑:我在github中找到了Endicia的一个较早的wsdl,其中定义行是这样的
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="www.envmgr.com/LabelService" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="www.envmgr.com/LabelService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
在为未知类型s1:...引发了一些错误之后,我用s:替换了s1 :,并且wsdl如我所料被导入,不确定它是否仍然可以正常工作,但很快我就会发现。抱歉,这次我太急躁,无法提出问题,希望这会在以后对您有所帮助。