WebService问题,导入WSDL文件生成的代码不能编译 ( 积分: 200 )

  • 主题发起人 主题发起人 铁桶师叔
  • 开始时间 开始时间

铁桶师叔

Unregistered / Unconfirmed
GUEST, unregistred user!
----------------------------WSDL文件,NetBeans5.5生成---------------------------------------------
<?xml version= &quot;1.0 &quot;
encoding= &quot;UTF-8 &quot;
?>
- <definitions xmlns= &quot;http://schemas.xmlsoap.org/wsdl/ &quot;
xmlns:tns= &quot;http://bf/ &quot;
xmlns:xsd= &quot;http://www.w3.org/2001/XMLSchema &quot;
xmlns:soap= &quot;http://schemas.xmlsoap.org/wsdl/soap/ &quot;
targetNamespace= &quot;http://bf/ &quot;
name= &quot;BalanceFundWSService &quot;>
- <types>
- <xsd:schema>
<xsd:import schemaLocation= &quot;http://localhost:8084/BalanceFund/BalanceFundWS?xsd=1 &quot;
namespace= &quot;http://bf/ &quot;
/>
</xsd:schema>
</types>
- <message name= &quot;getBlanceData &quot;>
<part element= &quot;tns:getBlanceData &quot;
name= &quot;parameters &quot;
/>
</message>
- <message name= &quot;getBlanceDataResponse &quot;>
<part element= &quot;tns:getBlanceDataResponse &quot;
name= &quot;parameters &quot;
/>
</message>
- <portType name= &quot;BalanceFundWS &quot;>
- <operation name= &quot;getBlanceData &quot;>
<input message= &quot;tns:getBlanceData &quot;
/>
<output message= &quot;tns:getBlanceDataResponse &quot;
/>
</operation>
</portType>
- <binding name= &quot;BalanceFundWSPortBinding &quot;
type= &quot;tns:BalanceFundWS &quot;>
<soap:binding style= &quot;document &quot;
transport= &quot;http://schemas.xmlsoap.org/soap/http &quot;
/>
+ <operation name= &quot;getBlanceData &quot;>
<soap:operation soapAction= &quot;
&quot;
/>
- <input>
<soap:body use= &quot;literal &quot;
/>
</input>
- <output>
<soap:body use= &quot;literal &quot;
/>
</output>
</operation>
</binding>
- <service name= &quot;BalanceFundWSService &quot;>
- <port name= &quot;BalanceFundWSPort &quot;
binding= &quot;tns:BalanceFundWSPortBinding &quot;>
<soap:address location= &quot;http://localhost:8084/BalanceFund/BalanceFundWS &quot;
/>
</port>
</service>
</definitions>
--------------------------------------------------------------------------------------------------------------------------
---------------------------------生成的Delphi7文件---------------------------------------------------------------------------
unit BalanceFundWS1;

interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type
// ************************************************************************ //
// The following types, referred to in the WSDL do
cument are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the do
cument. The types from the latter category
// typically map to predefined/known XML or Borland types;
however, they could also
// indicate incorrect WSDL do
cuments that failed to declare or import a schema type.
// ************************************************************************ //
// !:getBlanceData - &quot;http://bf/ &quot;
// !:getBlanceDataResponse - &quot;http://bf/ &quot;

// ************************************************************************ //
// Namespace : http://bf/
// transport : http://schemas.xmlsoap.org/soap/http
// style : do
cument
// binding : BalanceFundWSPortBinding
// service : BalanceFundWSService
// port : BalanceFundWSPort
// URL : http://localhost:8084/BalanceFund/BalanceFundWS
// ************************************************************************ //
BalanceFundWS = interface(IInvokable)
[ '{FED72D73-C0E4-2D2C-374C-087172486963} ']
function getBlanceData(const parameters: getBlanceData): getBlanceDataResponse;
stdcall;
end;

function GetBalanceFundWS(UseWSDL: Boolean=System.False;
Addr: string= ' ';
HTTPRIO: THTTPRIO = nil): BalanceFundWS;

implementation
function GetBalanceFundWS(UseWSDL: Boolean;
Addr: string;
HTTPRIO: THTTPRIO): BalanceFundWS;
const
defWSDL = 'http://localhost:8084/BalanceFund/BalanceFundWS?wsdl ';
defURL = 'http://localhost:8084/BalanceFund/BalanceFundWS ';
defSvc = 'BalanceFundWSService ';
defPrt = 'BalanceFundWSPort ';
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 BalanceFundWS);
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;


initialization
InvRegistry.RegisterInterface(TypeInfo(BalanceFundWS), 'http://bf/ ', 'UTF-8 ');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(BalanceFundWS), ' ');
InvRegistry.RegisterInvokeOptions(TypeInfo(BalanceFundWS), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(BalanceFundWS), ioLiteral);

end.

-------------------------------------------------------------------------------------------------------------
------------------------------------------报错信息------------------------------------------------------------
[Error] BalanceFundWS1.pas(40): Undeclared identifier: 'getBlanceData '
[Error] BalanceFundWS1.pas(40): Undeclared identifier: 'getBlanceDataResponse '
[Fatal Error] Project1.dpr(6): Could not compile used unit 'BalanceFundWS1.pas '

高手救命啊
 
后退
顶部