kodlian/AlamofireXMLRPC

How to handle parser exceptions?

Closed this issue · 0 comments

Hi, i'm trying to reach the service API with this lib, and i see using response.data that response returns as xml. But, XMLRPCNode says

FAILURE: fault(node: 
)

Here is real response:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<fault>
<value><struct>
<member><name>faultCode</name>
<value><i4>-506</i4></value></member>
<member><name>faultString</name>
<value><string>Method 'one.user.show' not defined</string></value></member>
</struct></value>
</fault>
</methodResponse>

I'm really new to swift(like second day), so maybe i'm missing some debug options, but how could i fix this?

P.S. I'm using totally same "structure" as in example provided:

let data: NSData = ...
let params: [Any] = [42, "text", 3.44, Date(), data]
AlamofireXMLRPC.request("http://localhost:8888/xmlrpc", methodName: "foo", parameters: params).responseXMLRPC { (response: DataResponse<XMLRPCNode>) -> Void in
	   switch response.result {
      case .success(let value):
      		if let message = value[0].string, age = value[1]["age"].int32  {
              ...
     		}
      case .failure:
            ...
      }