为什么 我用C++ builder 2007 编Web Service 服务器 中 index stored 属性传不到wsdl 文件中
接口名称:WSDemo
主要服务端程序如下:
WSDemoImpl.h
#if !defined(IS_OPTN)
#define IS_OPTN 0x0001
#endif
class TRemotableMember: public TRemotable {
private:
int Fa;
bool Fa_Specified;
int Fb;
bool Fb_Specified;
void __fastcall Seta(int Index, int _prop_val)
{ Fa = _prop_val; Fa_Specified = true; }
bool __fastcall a_Specified( int Index )
{ return Fa_Specified; }
void __fastcall Setb(int Index, int _prop_val)
{ Fb = _prop_val; Fb_Specified = true; }
bool __fastcall b_Specified( int Index )
{ return Fb_Specified; }
__published:
__property int a = { index=IS_OPTN, read=Fa, write=Seta, stored = a_Specified};
__property int b = { index=IS_OPTN, read=Fb, write=Setb, stored = b_Specified};
};
// ************************************************************************ //
// Invokable interfaces must derive from IInvokable
// The methods of the interface will be exposed via SOAP
// ************************************************************************ //
__interface INTERFACE_UUID("{D77734F7-4302-4FF0-A44E-7B9FFFB6366F}") IWSDemo : public IInvokable
{
public:
virtual TRemotableFun * bbb( const TRemotableMember *m ) = 0;
};
typedef DelphiInterface<IWSDemo> _di_IWSDemo;
#endif // WSDemoH
——————————————————————————————————————
WSDemoImpl.cpp
// ************************************************************************ //
// TWSDemoImpl implements interface IWSDemo
// ************************************************************************ //
class TWSDemoImpl : public TInvokableClass, public IWSDemo
{
public:
virtual TRemotableFun * bbb( const TRemotableMember *m);
//virtual int bbb(const int *m);
/* IUnknown */
#ifndef STDMETHODCALLTYPE
#define STDMETHODCALLTYPE __stdcall
#endif
// TODO: JK : where should these next two come from
#ifndef S_OK
#define S_OK 0
#endif
#ifndef E_NOINTERFACE
#define E_NOINTERFACE -1
#endif
HRESULT STDMETHODCALLTYPE QueryInterface(const GUID& IID, void **Obj)
{ return GetInterface(IID, Obj) ? S_OK : E_NOINTERFACE; }
ULONG STDMETHODCALLTYPE AddRef() { return TInvokableClass::_AddRef(); }
ULONG STDMETHODCALLTYPE Release() { return TInvokableClass::_Release(); }
};
TRemotableFun * TWSDemoImpl::bbb( const TRemotableMember *m )
{
TRemotableFun * ps = new TRemotableFun;
ps->t1 = m->a + m->b;
ps->t2 = m->a - m->b;
return ( ps );
}
//注册
static void RegTypes()
{
RemClassRegistry()->RegisterXSClass(__classid(TRemotableMember), L"urn:WSDemoImpl", L"TRemotableMember","",false);
RemClassRegistry()->RegisterXSClass(__classid(TRemotableFun), L"urn:WSDemoImpl", L"TRemotableFun","",false);
InvRegistry()->RegisterInterface(__delphirtti(IWSDemo));
InvRegistry()->RegisterInvokableClass(__classid(TWSDemoImpl), WSDemoFactory);
}
#pragma startup RegTypes 32
static void UnRegTypes()
{
RemClassRegistry()->UnRegisterXSClass(__classid(TRemotableMember));
RemClassRegistry()->UnRegisterXSClass(__classid(TRemotableFun));
}
生成的服务端放入iis虚拟目录abc中
应用wsdl Importer 把服务端的端口导入客户端
路径:http://localhost/abc/ClaCGISer.exe/wsdl/IWSDemo
之后发现IWSDemo.h中类"TRemotableMember"中变量的定义少了Index和stored 属性
class TRemotableMember : public TRemotable {
private:
int Fa;
int Fb;
__published:
__property int a = { read=Fa, write=Fa };
__property int b = { read=Fb, write=Fb };
};
通过浏览器查看http://localhost/abc/ClaCGISer.exe/wsdl/IWSDemo 服务端的wsdl文件貌似也没有index和stored的编码
请问index和stored如何导入wsdl文件中 以便客户端使用,还有index和stored有什么用处。
高手给指点下,不胜感激!