Java JAX-WS客户端处理SOAPFaultException

Java JAX-WS客户端处理SOAPFaultException,java,web-services,jaxb,jax-ws,soap-client,Java,Web Services,Jaxb,Jax Ws,Soap Client,我连接到的web服务对其所有异常抛出一个SOAPFaultException,这意味着应用程序只抛出RuntimeExceptions 使用wsimport,我生成了连接服务并与之通信的代码和对象,它还生成了JAXB对象,该对象表示SOAPFaultException的detail元素中的xml内容 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w

我连接到的web服务对其所有异常抛出一个
SOAPFaultException
,这意味着应用程序只抛出
RuntimeExceptions

使用wsimport,我生成了连接服务并与之通信的代码和对象,它还生成了JAXB对象,该对象表示
SOAPFaultException
detail
元素中的xml内容

   <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Soap Exception From Server</faultstring>
         <faultactor>url</faultactor>
         <detail>
            <MyResponse>
               <myID>123</myId>
               <serverName>Test</serverName>
               <error>
                  <desc>Unable to verify id</desc>
               </error>
            </MyResponse>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

soap:服务器
来自服务器的Soap异常
网址
123
试验
无法验证id
Wsimport生成了一个名为
MyResponse
的jaxb对象,其中
myId
serverName
error
desc
作为变量


我想知道如何使用
detail
元素数据填充生成的
MyResponse
jaxb对象,还是必须按节点浏览元素以获取值?

不完全确定这个问题;可能与?Hi scotth有关系/重叠,谢谢您的回复。我已经更新了问题。我不知道是否可以自动反序列化
MyResponse
,但也许可以手动使用
JAXBContext
,并通过