gpt4 book ai didi

exception - 单向操作抛出异常

转载 作者:行者123 更新时间:2023-12-02 05:08:59 27 4
gpt4 key购买 nike

假设您有以下操作:

void AddCustomer(Customer)

(即一个客户对象作为输入,没有输出)

为了遵守 WS-I BP 1.1,您不得为单向操作定义故障消息 [1]。但是,您可能希望抛出异常以防万一,例如,客户是重复的。你将如何实现这一目标?将操作定义为带有空响应的请求/响应,表示操作成功?在我看来不是那么漂亮......也许你知道另一种方式?我的意思是:在 java/.net 程序中,您仍然希望能够为 void 方法抛出异常...

例子:

<operation name="AddCustomer">
<input message="tns:AddCustomerRequest"/>
<output message="tns:AddCustomerResponse"/>
<fault name="DuplicateCustomer" message="tns:DuplicateFault"/>
</operation>

其中 AddCustomerResponse 将是一个空序列。

[1] http://www.w3.org/TR/wsdl#_porttypes

最佳答案

根据 wsdl 1 规范,对此没有解决方案。

关于exception - 单向操作抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7607582/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com