Delphi使用< schema& gt;将TXMLData包装在SOAP请求中标签 [英] Delphi wrapping TXMLData in SOAP request with &lt;schema&gt; tag
问题描述
我正在使用TXMLData发送XML,而Delphi在请求中添加了一个标记,我的代码如下:
I'm sending a XML using TXMLData and Delphi is adding a tag in the request, my code is like this:
RequestData := TXMLData.Create;
RequestData.LoadFromXML('<MyXML>[contents here]</MyXML>');
MyService.ExecuteRequest(RequestData);
我使用THTTPRIO的OnBeforeExecute获取请求的内容,并将该内容包装在一个标记中,如下所示:
I used the OnBeforeExecute of the THTTPRIO to get the content of the Request and the content is wrapped in a tag, something like this:
<SOAP-ENV:Body>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<MyXML>
</schema>
</SOAP-ENV:Body>
我不知道为什么要添加此标签.如何防止添加?
I can't figure out why this tag is being added. How can I prevent it from being added?
此外,我不喜欢在OnBeforeExecute事件中编辑SOAPRequest以将其删除而又不知道存在该想法的想法.
Also, I don't like the idea of editing the SOAPRequest in the OnBeforeExecute event to remove it without know with it is there.
推荐答案
已解决.
Delphi将Web服务映射为:
Delphi was mapping the webservice as:
RequestData = TXMLData;
MyService = interface(IInvokable)
['{5D2D1DD8-AE56-AD82-FC59-8669C576E1AF}']
function ExecuteRequest(const RequestData: RequestData): RequestResult; stdcall;
end;
更改:
RequestData = TXMLData;
到
RequestData = class(TXMLData);
解决了这个问题.
现在delphi使用"RequestData"作为请求正文中XML的顶部节点,而不是添加架构标签.
Now delphi is using the "RequestData" as the top node of the XML in the Body of the request, instead of adding a schema tag.
现在,呼叫正在生成如下内容:
Now the call is generating something like this:
<RequestData>[MyXML]</RequestData>
我要发送的是什么.
这篇关于Delphi使用< schema& gt;将TXMLData包装在SOAP请求中标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!