문제

Apache의 XML-RPC 구현을 통해 반환된 예외에서 원래 예외를 추출하는 가장 쉬운 방법은 무엇입니까?

도움이 되었습니까?

해결책

Apache 예외에서 원인 예외를 얻는 것이 올바른 것으로 나타났습니다.

} catch (XmlRpcException rpce) {
    Throwable cause = rpce.getCause();
    if(cause != null) {
        if(cause instanceof ExceptionYouCanHandleException) {
            handler(cause);
        }
        else { throw(cause); }
    }
    else { throw(rpce); }
}

다른 팁

에 따르면 XML-RPC 사양 XML에 "오류"를 반환합니다.

이것이 당신이 언급하고 있는 "예외"입니까, 아니면 XML-RPC 호출을 하는 동안 생성된 Java 예외를 언급하고 있습니까?

오류 예

HTTP/1.1 200 OK
Connection: close
Content-Length: 426
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:02 GMT
Server: UserLand Frontier/5.1.2-WinNT

<?xml version="1.0"?>
<methodResponse>
  <fault>
    <value>
      <struct>
      <member>
        <name>faultCode</name>
        <value><int>4</int></value>
      </member>
      <member>
        <name>faultString</name>
        <value>
          <string>Too many parameters.</string>
        </value>
      </member>
      </struct>
    </value>
  </fault>
</methodResponse> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top