Exception 创建SOAP错误响应
我正在创建一个Web服务,我公司的内部客户将调用该服务。服务方法如下所示:Exception 创建SOAP错误响应,exception,soap,Exception,Soap,我正在创建一个Web服务,我公司的内部客户将调用该服务。服务方法如下所示: <?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/Pro
<?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>
CreateProposalResponse ProposalSOAService::CreateProposal(CreateProposalRequest)
对于CreateProposalResponse消息,我需要将业务错误消息添加到响应中。我已经读了很多关于将错误放入SOAP头中的内容,但是对于业务错误,我觉得这不是放置它们的合适位置,因为这应该是系统/传输/验证类错误,而不是业务错误。下面是我对createProposition()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>
022483
SBT支柱
该提案是针对SBT的
SAS
试验
SBT38829
2009-01-01
2025-01-01
SBT
王牌
简单地在消息中使用一个
数组元素作为可选元素,并用一个或多个描述错误的
元素填充它,怎么样?然后,您可以指定响应消息将包含填充的
元素(以及即使在遇到错误时也可能需要的其他元数据元素;可能
和
都是这样的元素?)但不包含
,或者它不包含
但不包含
(否则该元素将为空)
(顺便说一句,我同意应该在消息正文中指出业务错误,而不是SOAP错误。)我同意Aasmund Eldhuset,除非这些错误表明操作失败。在这种情况下,您应该使用SOAP错误。谢谢您确认了我认为正确的方法。