我在Delphi XE SOAP服务器项目中有这个接口:
type TRequest=class(tremotable)
...
type tCollection=class(tremotable)
...
imyintf = interface(IInvokable)
['{929F54BA-50C1-47A7-91F8-3EC61931F80E}']
function GetSomething(const params:TRequest)
: tCollection; stdcall;
end;
所有字段都有索引IS_REF = $ 0080。初始化看起来像这样:
InvRegistry.RegisterInterface(TypeInfo(imyintf),'ns');
InvRegistry.RegisterInvokeOptions(TypeInfo(imyintf), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(imyintf), ioLiteral);
RemClassRegistry.RegisterXSClass(TRequest,'Request','Request');
RemClassRegistry.RegisterXSClass(tCollection,'Collection','Collection');
由SOAPUI请求生成如下所示:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="ns" xmlns:ns2="http://www.regionh.dk/regionh.dk/cis/xml.schema/" xmlns:urn="urn:Intf-icis2opus" xmlns="http://www.regionh.dk/regionh.dk/xml.schema/" xmlns:ns3="http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/">
<soapenv:Header/>
<soapenv:Body>
<ns:Request soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<params xsi:type="get:Request" xmlns:get="Request" xmlns="">
...
</params>
</ns:Request>
</soapenv:Body>
</soapenv:Envelope>
但是客户端希望在没有标记的情况下发送XML请求。 Params是我函数中输入参数的名称。如果我按他的意愿发送,我在请求对象中没有。如果没有该标签,我应该如何更改我的应用程序?
=============================
解决。我把所有字段从请求“param”输入参数放到函数中。像这样:
function GetSomething(const ...<there are variables from "Trequest" object>...)
: TCollection;