我正在创建一个Web服务,我公司的内部客户端将会调用它。服务方法如下所示:创建SOAP错误响应
CreateProposalResponse ProposalSOAService :: CreateProposal(CreateProposalRequest)
对于CreateProposalResponse消息我需要的业务错误信息添加到响应。我一直在阅读很多有关将错误放入SOAP Headers的问题,但对于业务错误,我不认为这是放置它们的适当位置,因为这应该是系统/传输/验证类型的错误而不是业务错误。以下是我对CreateProposal()SOA调用的响应XML。有人可以告诉我如何将错误消息添加到此响应中吗?我很难想象这一点,以及呼叫客户如何确定与正常响应和业务错误/异常的区别。
我CreateProposalResponse消息如下所示:
<?xml version="1.0" encoding="UTF-8" ?>
<CreateProposalResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.xxx.com/aces/proposal src/Proposal_v1.0.xsd"
xmlns="http://xmlns.raytheon.com/aces/proposal">
<userId>022483</userId>
<Proposal>
<proposalTitle>SBT Prop</proposalTitle>
<proposalDescription>Proposal is for SBT</proposalDescription>
<businessSegmentCode>SAS</businessSegmentCode>
<proposalType>Test</proposalType>
<proposalExternalRefID>SBT38829</proposalExternalRefID>
<proposalStartDate>2009-01-01</proposalStartDate>
<proposalEndDate>2025-01-01</proposalEndDate>
</Proposal>
<sourceSystemID>SBT</sourceSystemID>
<targetSystemID>ACES</targetSystemID>
</CreateProposalResponse>
谢谢你已经证实我觉得这是正确的做法。 –