如何使 ColdFusion Web 服务返回 SOAP 而不是 WDDX?

发布于 2024-12-14 09:18:58 字数 72 浏览 1 评论 0原文

我创建了一个 ColdFusion Web 服务,但它返回 WDDX 而不是 SOAP。如何让它返回 SOAP 而不是 WDDX?

I've created a ColdFusion Web Service, but it's returning WDDX instead of SOAP. How do I make it return SOAP instead of WDDX?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

向地狱狂奔 2024-12-21 09:18:58

返回 XML 对象,并将“returnformat”参数设置为“plain”。

<cffunction name="GetData" returntype="xml" returnformat="plain">

Have the <cffunction> return an XML object, and have the "returnformat" parameter be set to "plain".

<cffunction name="GetData" returntype="xml" returnformat="plain">
楠木可依 2024-12-21 09:18:58

对于复杂对象,您需要正确设置 CFC。阅读:使用 ColdFusion 组件定义 Web 服务的数据类型

更新: 或者,您可以使用以下命令自行创建对象的 XML 表示形式: ,然后在 cffunction 中使用 returnType="xml" 返回 XML 对象。

您可以查看 Coldbox 的 XMLConverter 插件作为转换内置 CF 复合体的代码示例类型转换为 XML。

For complex objects, you need to setup the CFCs correctly. Read: Using ColdFusion components to define data types for web services

update: Or, you can create the XML representation of your object yourself with <cfxml>, then return the XML object with returnType="xml" in cffunction.

You may check out coldbox's XMLConverter Plugin as code sample for converting built-in CF complex types into XML.

万劫不复 2024-12-21 09:18:58

带有 access=remote 的 CFC 方法应该返回soap,而不是WDDX。我确信我已经使用这个功能很多年了。我怀疑可能发生的情况是内容类型基于客户端发出的请求。我会下载 Soap-UI 并测试 http://your.server/yourCFC.cfc?wsdl 查看 SOAP-UI 是否会收到 WDDX 回传。如果确实如此,我会有点不知所措,但无论如何请在这里报告,我会进一步查看。
如果 Soap-UI 看到正确的响应,请查看它发送的标头,并将它们与您正在发出的请求进行比较(可能通过浏览器?)

您还可以使用 Fiddler 记录soap-ui 流量并将其与任何其他请求源进行比较。

上面的http请求可能完全关闭了,但是检查起来相对容易,我认为它已经敲响了警钟。

您可能还想检查您正在编写的函数的返回类型。为了让 CF 生成良好的 WSDL,它需要能够从您返回的 CFC 中提取元数据。

A CFC method with access=remote ought to return soap, rather than WDDX. I'm sure I've used this functionality for years. What I'm suspecting may be happening is that the content-type is based on the request a client makes. I would download Soap-UI and test http://your.server/yourCFC.cfc?wsdl to see whether SOAP-UI gets WDDX thrown back at it. If is does, I'm at a bit of a loss, but do report it here anyway and I'll take a further look.
If Soap-UI sees a proper response, take a look at the headers it's sending and compare them to the request you're making (possibly through the browser?)

You can also use Fiddler to record soap-ui traffic and compare that against any other source of requests.

The http request thing above may be completely off, but it's relatively easy to check and I think it's ringing a bell.

You may also want to check the return type of the function you're writing. In order for CF to generate a good WSDL, it needs to be able to extract metadata from the CFC you're returning.

弃爱 2024-12-21 09:18:58

有点晚了,但是您是否将其作为普通 HTTP 请求而不是 SOAP 数据包进行访问?

例如,您是否这样做:

http://api.example.com /something.cfc?method=test&arg1=val1

而不是带有信封、标头、正文等的实际 SOAP 请求?

HTTP 请求默认返回 WDDX,或者通过指定返回格式返回 JSON,而 SOAP 请求将以您要查找的格式返回数据。

A bit late to the game but were you hitting it as a plain HTTP request and not as with a SOAP packet?

For example were you doing this:

http://api.example.com/something.cfc?method=test&arg1=val1

instead of an actual SOAP request with envelope, headers, body, etc?

The HTTP request returns WDDX by default or JSON by specifying the returnformat, while a SOAP request will return data in the format you are seeking.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文