-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASMX service return List<Object> #74
Comments
From a SOAP message (XML) is hard to know if it return a single value or an array, this is possible only with processing the WSDL definition, but this takes a long processing time for each request, many many seconds for each request. The our framework only processes the response message, if it contains one element then it is considered as a dictionary or string, if it contains more consecutive elements, with the same identifier, it is considered as an array. When you get the value through the key, and it can return a single value or multi values, we recommend using the method name isKindOfClass, like below: id obj = [responseDict objectForKey:@"my-key"]; // generic object
if ([obj isKindOfClass:[NSDictionary class]]) {
NSDictionary *dictValue = (NSDictionary*)obj;
// TODO: your code here
} else if ([obj isKindOfClass:[NSArray class]]) {
NSArray *arrayValues = (NSArray*)obj;
// TODO: your code here
} |
Thank you for your help. I solved it. I have a another problem. My code is: My service is: publich bool TestService(objA obja, List lstobjb) I can receive obja , but lstobjb.count is alway return 0 How can i fix it? And how receive bool value from service Thank you |
try to set the property named |
I did, but It's not work |
You use Cocoapods ? I apologize, the last podspec had not been pushed to cocoapods, you try again now with pod update. |
I just download latest release (v.1.22). |
you can give us the URL of the service, and the method and the test credentials if required, so that we can test for you? |
I deleted my comment for security |
we not did understand the problem, but this is a sample code: // quotation
let quotation = ["QuotationID": "1234",
"FullName": "yourname",
"Email": "youemail",
"Phone": "yourphone"
] // TODO: complete with other key/values
soap.setValue(quotation, forKey: "quotation")
// single products
let product = ["ProductID": "1234",
"ProductCode": "code1234",
"ProductName": "prod-name"
] // TODO: complete with other key/values
// products
let lstproducts = [product, product, product]
soap.defaultTagName = "Product" // BUG: not work for array
soap.setValue(lstproducts, forKey: "lstproducts")
// soap request
soap.actionNamespaceSlash = true
soap.responseHeader = true;
soap.requestURL("http://www.b.....d.com/webservices/service-name.asmx", soapAction: "http://www.b....d.com/SendMail_Quotation",
completeWithDictionary: { (statusCode: Int, dict : [NSObject: AnyObject]!) -> Void in
let result:Dictionary = dict as Dictionary
NSLog("%@", result)
}, failWithError: { (error : NSError!) -> Void in
NSLog("%@", error)
}) note: during this test we found a bug that will fixes within one to two days, sorry. |
Thank you very much for your fast response. I will wait for the fix. |
Hi, P/s: method that return a single boolean value is very good |
which the error ? you can send us a complete example ? (you can use the email) us with the previous example we did have a response from the server, but the parameters are invalid and the server responded with an error message (invalid xml), look below: <?xml version="1.0" encoding="utf-8"?>
<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:Client</faultcode>
<faultstring>Server was unable to read request. ---> There is an error in XML document (1, 418). ---> Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).</faultstring>
<detail/>
</soap:Fault>
</soap:Body>
</soap:Envelope> |
Hi, I have a new webmethod: TestCountList
This is my example class ViewController: UIViewController {
} class Product : NSObject {
} |
Today we release a fix that resolves retrieval of the class name when you pass a user-object. |
Perfect. Thank you very much. Bug fixed, great library and great job. |
Hi,
Please help me.
My service return a List. If the list has multi value then everything is OK, but the list only has 1 element, it error: Could not cast value of type '__NSDictionaryM' (0x1249380) to 'NSArray' (0x124918c)
And, how to handle service method return a object, and service return bool value?
Thank you.
The text was updated successfully, but these errors were encountered: