Delphi使用< schema>将TXMLData包装在SOAP请求中。标签 [英] Delphi wrapping TXMLData in SOAP request with <schema> 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>将TXMLData包装在SOAP请求中。标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!