-
-
Notifications
You must be signed in to change notification settings - Fork 75
How to use with Notifications
Prioregroup.com edited this page Feb 27, 2017
·
3 revisions
#import <SOAPEngine64/SOAPEngine.h>
//#import <SOAPEngineOSX/SOAPEngine.h>
//#import <SOAPEngineTV/SOAPEngine.h>
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(soapDidFinishLoading:)
name:SOAPEngineDidFinishLoadingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(soapDidFail:)
name:SOAPEngineDidFailWithErrorNotification object:nil];
// standard soap service (.asmx)
SOAPEngine *soap = [[SOAPEngine alloc] init];
soap.userAgent = @"SOAPEngine";
soap.delegate = self; // use SOAPEngineDelegate
//soap.responseHeader = YES; // only for not Microsoft standard services (like Apache server)
// each single value
[soap setValue:@"my-value1" forKey:@"Param1"];
[soap setIntegerValue:1234 forKey:@"Param2"];
// service url without ?WSDL, and you can search the soapAction in the WSDL
[soap requestURL:@"http://www.my-web.com/my-service.asmx"
soapAction:@"http://www.my-web.com/My-Method-name"];
#pragma mark - SOAPEngine Notifications
- (void)soapDidFinishLoading:(NSNotification*)note
{
NSLog(@"XML: %@", note.userInfo[SOAPEngineXMLResponseKey]);
NSLog(@"StatusCode: %@", note.userInfo[SOAPEngineStatusCodeKey]);
NSLog(@"Dictionary: %@", note.userInfo[SOAPEngineXMLDictionaryKey]);
NSLog(@"Data: %@", note.userInfo[SOAPEngineXMLDatayKey]);
}
- (void)soapDidFail:(NSNotification*)note
{
NSLog(@"Error: %@", note.userInfo[SOAPEngineErrorKey]);
}