Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WSDL: generate WSDL definition of complex type not in the file

60 views
Skip to first unread message

fame...@toto.com

unread,
Jul 17, 2008, 5:46:15 AM7/17/08
to
Hello Everybody,

i have the following problem:

i try to create a wsdl from an soap server i wrote. (code below)
the generated WSDL doesn't contain the definition of the content of
tMyObject. (end of message)

thank you for your help,

Ele.

// ************************************************************************
//
unit SubscriptionServiceClient;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns, sysutils,
classes;

const
AS_UNBOUNDED = false;

type
tMyObject = class(tObject)
name: string;
value: variant;
end;

//arrayofobject = array of tinterfacedobject;
//arrayofobject = array of tobject;
// arrayofobject = anytype;
arrayofobject = array of tMyObject;

SubscriptionSendChannelTarget = (Data, Command, Channel1, Channel2,
Channel3);


//
************************************************************************ //
// Namespace : SubscriptionServiceClient
// soapAction: SubscriptionServiceClient/ISubscriptionClient/Receive
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : DefaultBinding_ISubscriptionClient
//
************************************************************************ //
ISubscriptionClient = interface(IInvokable)
['{B8A18F6D-4B7B-D556-42BB-DAECB7708D5E}']
procedure Receive(const uid: WideString; const data: TByteDynArray;
const target: SubscriptionSendChannelTarget); stdcall;
procedure test(const prms: arrayofobject); stdcall;
end;

implementation

uses uMain;

type

ISubscriptionClientImpl = class(TInvokableClass, ISubscriptionClient)
public
{ ISubscriptionClient }
procedure Receive(const uid: WideString; const data: TByteDynArray;
const target: SubscriptionSendChannelTarget); stdcall;
procedure test(const prms: arrayofobject); stdcall;
end;

procedure ISubscriptionClientImpl.Receive(const uid: WideString; const data:
TByteDynArray; const target: SubscriptionSendChannelTarget);
var
i : integer;
sc : tTMISubscription;
begin
gLog.add(uid);


if gSubscriptionList.Find(uid, i) then
begin
glog.add('subsc: ' + inttostr(i));
sc:= tTMISubscription(gSubscriptionList.Objects[i]);

// glog.add('Receiving data: ' + sc.gui + ', ' + sc.service);
gLog.add(sc.gui);
sc.receive(data);
end;
end;

procedure ISubscriptionClientImpl.test(const prms: arrayofobject);
begin
//
end;

initialization
InvRegistry.RegisterInterface(TypeInfo(ISubscriptionClient),
'SubscriptionServiceClient', 'utf-8');
InvRegistry.RegisterInvokableClass(ISubscriptionClientImpl);
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ISubscriptionClient),
'SubscriptionServiceClient/ISubscriptionClient/Receive');
RemClassRegistry.RegisterXSInfo(TypeInfo(SubscriptionSendChannelTarget),
'http://schemas.datacontract.org/2004/07/Prodata.Be.Networking',
'SubscriptionSendChannelTarget');
//
RemClassRegistry.RegisterExternalPropName(TypeInfo(SubscriptionSendChannelTarget),
'Default_', 'Default');

nbThreads:= 0;

end.

//***********************************************************************************************//

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
name="ISubscriptionClientservice" targetNamespace="http://tempuri.org/"
xmlns:tns="http://tempuri.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns1="http://schemas.datacontract.org/2004/07/Prodata.Be.Networking"
xmlns:ns2="urn:SubscriptionServiceClient">
<types>
<xs:schema
targetNamespace="http://schemas.datacontract.org/2004/07/Prodata.Be.Networking"
xmlns="http://schemas.datacontract.org/2004/07/Prodata.Be.Networking">
<xs:simpleType name="SubscriptionSendChannelTarget">
<xs:restriction base="xs:string">
<xs:enumeration value="Data"/>
<xs:enumeration value="Command"/>
<xs:enumeration value="Channel1"/>
<xs:enumeration value="Channel2"/>
<xs:enumeration value="Channel3"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<xs:schema targetNamespace="urn:SubscriptionServiceClient"
xmlns="urn:SubscriptionServiceClient">
<xs:complexType name="arrayofobject">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:sequence/>
<xs:attribute ref="soapenc:arrayType"
n1:arrayType="ns2:tMyObject[]" xmlns:n1="http://schemas.xmlsoap.org/wsdl/"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="tMyObject">
<xs:sequence/>
</xs:complexType>
</xs:schema>
</types>
<message name="Receive0Request">
<part name="uid" type="xs:string"/>
<part name="data" type="xs:base64Binary"/>
<part name="target" type="ns1:SubscriptionSendChannelTarget"/>
</message>
<message name="Receive0Response"/>
<message name="test1Request">
<part name="prms" type="ns2:arrayofobject"/>
</message>
<message name="test1Response"/>
<portType name="ISubscriptionClient">
<operation name="Receive">
<input message="tns:Receive0Request"/>
<output message="tns:Receive0Response"/>
</operation>
<operation name="test">
<input message="tns:test1Request"/>
<output message="tns:test1Response"/>
</operation>
</portType>
<binding name="ISubscriptionClientbinding" type="tns:ISubscriptionClient">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Receive">
<soap:operation
soapAction="SubscriptionServiceClient/ISubscriptionClient/Receive"
style="rpc"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="SubscriptionServiceClient"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="SubscriptionServiceClient"/>
</output>
</operation>
<operation name="test">
<soap:operation
soapAction="SubscriptionServiceClient/ISubscriptionClient/Receive"
style="rpc"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="SubscriptionServiceClient"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="SubscriptionServiceClient"/>
</output>
</operation>
</binding>
<service name="ISubscriptionClientservice">
<port name="ISubscriptionClientPort"
binding="tns:ISubscriptionClientbinding">
<soap:address
location="http://6710b-lecocqe:1024/soap/ISubscriptionClient"/>
</port>
</service>
</definitions>

//***********************************************************************************************************************//

Rick Francken

unread,
Jul 25, 2008, 1:18:07 PM7/25/08
to
Assuming Delphi Win32, Have you tried deriving your class from TRemotable? Try
this:

type
TMyObject = class(TRemotable)
private
fName: string;
fValue: variant;
public constructor Create;
published
property Name: string read fName write fName;
property Value: variant read fValue write fValue;
end;

NOTE: the properties must be published, not public, so that runtime type info is
available.

in the Initialization and Finalization sections add these...

initialization

RemClassRegistry.RegisterXSClass(TMyObject,'', 'TMyObject','');

RemClassRegistry.RegisterXSInfo(TypeInfo(arrayofobject), '', 'arrayofobject');

finalization
RemClassRegistry.UnRegisterXSClass(TMyObject);

RemClassRegistry.UnRegisterXSInfo(TypeInfo(arrayofobject));

Good luck,

Rick Francken
www.franckensoft.com

0 new messages