开发者

Throw exception from one-way operation

Assume that you have the following operation:

void AddCustomer(Customer)

(i.e. a Customer object as input and no output)

Complying to WS-I BP 1.1 you are not allowed to define fault messages for one-way operations [1]. However, you may want to throw an exception in case, for example, the customer is a duplicate. How would you achieve this? Defining the operation as a request/response with an empty response signaling that the operation succeeded? Not that pretty in my opinion... Maybe you know another way? I mean: within a java/.net program you still want to be able to throw exceptions also for void-methods...

Example:

<operation name="AddCustomer">
    <input message="t开发者_StackOverflow社区ns:AddCustomerRequest"/>
    <output message="tns:AddCustomerResponse"/>
    <fault name="DuplicateCustomer" message="tns:DuplicateFault"/>
</operation>

where AddCustomerResponse would be an empty sequence.

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


According to the wsdl 1 specification there is no solution for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜