All Projects → priore → Soapengine

priore / Soapengine

Licence: other
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app.

Programming Languages

swift
15916 projects
swift4
162 projects
swift3
66 projects

Projects that are alternatives of or similar to Soapengine

Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-80.77%)
Mutual labels:  soap, xml, xcode
Exhibit
Exhibit is a managed screensaver App for tvOS.
Stars: ✭ 19 (-95.94%)
Mutual labels:  xcode, apple-tv
Python Benedict
dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘
Stars: ✭ 204 (-56.41%)
Mutual labels:  dictionary, xml
Phpcollections
A set of collections for PHP.
Stars: ✭ 53 (-88.68%)
Mutual labels:  dictionary, generic
Project Mulla
Talk to MPESA API via a REST API. Bringing the MPESA G2 API to the 21st century. --
Stars: ✭ 282 (-39.74%)
Mutual labels:  soap, xml
Servicestack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
Stars: ✭ 4,976 (+963.25%)
Mutual labels:  soap, xml
Genericdatasource
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift.
Stars: ✭ 127 (-72.86%)
Mutual labels:  generic, xcode
Go Xml
utility and code-generation libraries for XML
Stars: ✭ 197 (-57.91%)
Mutual labels:  soap, xml
Correios Brasil
Módulo completo consultar informações sobre o CEP, calcular o preço e os prazos das entregas das encomendas e também realizar o rastreio de multiplos produtos !
Stars: ✭ 240 (-48.72%)
Mutual labels:  soap, xml
Mlib
Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
Stars: ✭ 321 (-31.41%)
Mutual labels:  dictionary, generic
Sourceful
A syntax highlighting source editor for iOS and macOS using UITextView and NSTextView.
Stars: ✭ 449 (-4.06%)
Mutual labels:  xcode
Zek
Generate a Go struct from XML.
Stars: ✭ 451 (-3.63%)
Mutual labels:  xml
Example Ios Apps
 A curated list of Open Source example iOS apps developed in Swift. An amazing list for people who are beginners and learning ios development and for ios developers who need any example app or feature.
Stars: ✭ 461 (-1.5%)
Mutual labels:  xcode
Wiremock
A tool for mocking HTTP services
Stars: ✭ 4,790 (+923.5%)
Mutual labels:  xml
React Native Mixpanel
A React Native wrapper for Mixpanel tracking
Stars: ✭ 451 (-3.63%)
Mutual labels:  xcode
Dnspageview
一个纯 Swift 的轻量级、灵活且易于使用的 pageView
Stars: ✭ 461 (-1.5%)
Mutual labels:  xcode
Hero
Elegant transition library for iOS & tvOS
Stars: ✭ 20,547 (+4290.38%)
Mutual labels:  xcode
Node Xml2js
XML to JavaScript object converter.
Stars: ✭ 4,402 (+840.6%)
Mutual labels:  xml
Pbxprojhelper
A macOS tool help you handling project.pbxproj files. Written in Swift 5!
Stars: ✭ 444 (-5.13%)
Mutual labels:  xcode
Yomichan
Japanese pop-up dictionary extension for Chrome and Firefox.
Stars: ✭ 464 (-0.85%)
Mutual labels:  dictionary

SOAPEngine


Version Language Platform License codebeat badge Twitter: @DaniloPriore

This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and Apple TV app.

With this Framework you can create iPhone, iPad, Mac OS X and AppleTv apps that supports SOAP Client Protocol. This framework able executes methods at remote web services with SOAP standard protocol.

SDK 1.x vs SDK 2.x

We are in the process of releasing our next major SDK - SDK 2.x. Publishers who use SDK 1.x should continue to use it unless instructed otherwise. Please make sure you indicate the latest SDK 1.x version when using Cocoapods.

Features


  • Support both 2001 (v1.1) and 2003 (v1.2) XML schema.
  • Support array, array of structs, dictionary and sets.
  • Support for user-defined object with serialization of complex data types and array of complex data types, even embedded multilevel structures.
  • Supports ASMX Services, WCF Services (SVC) and now also the WSDL definitions.
  • Supports Basic, Digest and NTLM Authentication, WS-Security, Client side Certificate and custom security header.
  • Supports iOS Social Account to send OAuth2.0 token on the request.
  • AES256 or 3DES Encrypt/Decrypt data without SSL security.
  • An example of service and how to use it is included in source code.

Requirements for iOS


  • iOS 8.0 and later
  • Xcode 8.0 or later
  • Security.framework
  • Accounts.framework
  • Foundation.framework
  • UIKit.framework
  • libxml2.dylib

Requirements for Mac OS X


  • OS X 10.9 and later
  • Xcode 8.0 or later
  • Security.framework
  • Accounts.framework
  • Foundation.framework
  • AppKit.framework
  • Cocoa.framework
  • libxml2.dylib

Requirements for Apple TV


  • iOS 9.0 and later
  • Xcode 8.0 or later
  • Security.framework
  • Foundation.framework
  • UIKit.framework
  • libxml2.dylib

Limitations


Known issues


  • Swift 4: the library is currently written in Objective-C and when you import the swift library you will get build errors like this The use of Swift 3 @objc inference in Swift 4 mode is deprecated.

    For silent this warning is need sets Swift 3 @objc Inference to default value in the the Build settings of target. but It's not all; the classes used to create requests must be declared with @objcMembers and NSObject, eg:

     class MyClass { ... }
    
     let param = MyClass()
     // ...
     // ...
     let soap = SOAPEngine()
     soap.setValue(param, forKey: "myKey")
     // ...
     // ...
    

    the declaration of MyClass must become :

     @objcMembers class MyClass: NSObject { ... }
    

Security for Xcode 8.x or later


From the new Xcode 8 is required an additional setting for the apps, if this setting does not exist you will see a log message like this:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

To resolve this, add few keys in info.plist, the steps are:

  1. Open info.plist file of your project.
  2. Add a Key called NSAppTransportSecurity as a Dictionary.
  3. Add a Subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES as like following image.

NSAppTransportSecurity

ref link: http://stackoverflow.com/a/32631185/4069848

How to use


with Delegates :

	#import <SOAPEngine64/SOAPEngine.h>

	// standard soap service (.asmx)
	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	soap.delegate = self; // use SOAPEngineDelegate

	// 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 Delegates

	- (void)soapEngine:(SOAPEngine *)soapEngine didFinishLoading:(NSString *)stringXML {

	        NSDictionary *result = [soapEngine dictionaryValue];
        	// read data from a dataset table
        	NSArray *list = [result valueForKeyPath:@"NewDataSet.Table"];
	}

with Block programming :

	#import <SOAPEngine64/SOAPEngine.h>
	
	// TODO: your user object
	MyClass myObject = [[MyClass alloc] init];
	
	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	soap.version = VERSION_WCF_1_1; // WCF service (.svc)
	
	// service url without ?WSDL, and you can search the soapAction in the WSDL
	[soap requestURL:@"http://www.my-web.com/my-service.svc"
		  soapAction:@"http://www.my-web.com/my-interface/my-method"
			   value:myObject
			completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {
				NSLog(@"%@", dict);
			} failWithError:^(NSError *error) {
				NSLog(@"%@", error);
			}];

directly from WSDL (not recommended is slow) :

	#import <SOAPEngine64/SOAPEngine.h>
	
	// TODO: your user object
	MyClass myObject = [[MyClass alloc] init];
	
	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	
	// service url with WSDL, and operation (method name) without tempuri
	[soap requestWSDL:@"http://www.my-web.com/my-service.amsx?wsdl"
		    operation:@"my-method-name"
			    value:myObject
			completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {

              NSLog(@"Result: %@", dict);

			} failWithError:^(NSError *error) {

				NSLog(@"%@", error);
			}];

with Notifications :

	#import <SOAPEngine64/SOAPEngine.h>

	// TODO: your user object
	MyClass myObject = [[MyClass alloc] init];
	
	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	soap.version = VERSION_WCF_1_1; // WCF service (.svc)
		
    [[NSNotificationCenter defaultCenter] 
    			addObserver:self 
    			   selector:@selector(soapEngineDidFinishLoading:) 
    				   name:SOAPEngineDidFinishLoadingNotification 
    				 object:nil];
	
	// service url without ?WSDL, and you can search the soapAction in the WSDL
	[soap requestURL:@"http://www.my-web.com/my-service.svc" 
		  soapAction:@"http://www.my-web.com/my-interface/my-method"
		  	   value:myObject];
	
	#pragma mark - SOAPEngine Notifications
	
	- (void)soapEngineDidFinishLoading:(NSNotification*)notification
	{
    	SOAPEngine *engine = notification.object; // SOAPEngine object
    	NSDictionary *result = [engine dictionaryValue];
    	NSLog(@"%@", result);
	}

Synchronous request :

	#import <SOAPEngine64/SOAPEngine.h>
	
	NSError *error = nil;
    SOAPEngine *soap = [[SOAPEngine alloc] init];
    soap.responseHeader = YES; // use only for non standard MS-SOAP service like PHP
    NSDictionary *dict = [soap syncRequestURL:@"http://www.my-web.com/my-service.amsx" 
    						soapAction:@"http://tempuri.org/my-method" error:&error];
    NSLog(@"error: %@, result: %@", error, dict)

Swift 3 language :

        var soap = SOAPEngine()
        soap.userAgent = "SOAPEngine"
        soap.actionNamespaceSlash = true
        soap.version = VERSION_1_1
        soap.responseHeader = true // use only for non standard MS-SOAP service
        
        soap.setValue("param-value", forKey: "param-name")
        soap.requestURL("http://www.my-web.com/my-service.asmx",
            soapAction: "http://www.my-web.com/My-Method-name",
            completeWithDictionary: { (statusCode : Int, 
            					 dict : [AnyHashable : Any]?) -> Void in
                
                var result:Dictionary = dict! as Dictionary
                print(result)
                
            }) { (error : Error?) -> Void in
                
                print(error)
        }

settings for SOAP Authentication :

	#import <SOAPEngine64/SOAPEngine.h>

	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	
	// authorization
	soap.authorizationMethod = SOAP_AUTH_BASIC; // basic auth
	soap.username = @"my-username";
	soap.password = @"my-password";
	
	// TODO: your code here...
	

settings for Social OAuth2.0 token :

	#import <SOAPEngine64/SOAPEngine.h>
	#import <Accounts/Accounts.h>

	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	
	// token authorization
	soap.authorizationMethod = SOAP_AUTH_SOCIAL;
	soap.apiKey = @"1234567890"; // your apikey https://dev.twitter.com/
	soap.socialName = ACAccountTypeIdentifierTwitter;
	
	// TODO: your code here...
	

Encryption/Decryption data without SSL/HTTPS :

	#import <SOAPEngine64/SOAPEngine.h>

	SOAPEngine *soap = [[SOAPEngine alloc] init];
	soap.userAgent = @"SOAPEngine";
	soap.encryptionType = SOAP_ENCRYPT_AES256; // or SOAP_ENCRYPT_3DES
	soap.encryptionPassword = @"my-password";

	// TODO: your code here...
	

Params with Attributes :

    // book
    NSMutableDictionary *book = [NSMutableDictionary dictionaryWithObject:@"Genesis" forKey:@"name"];
    // chapter
    NSDictionary *attr = @{@"order": @"asc"};
    NSDictionary *child = [soap dictionaryForKey:@"chapter" value:@"1" attributes:attr];
    [book addEntriesFromDictionary:child]; // add chapter to book
    // book attributes
    [soap setValue:book forKey:@"Book" attributes:@{@"rack": @"2"}];

it builds a request like this:

    <Book rack="2">
        <name>Genesis</name>
        <chapter order="asc">1</chapter>
    </Book>

PAYPAL example with certificate :

	SOAPEngine *soap = [[SOAPEngine alloc] init];

    // PAYPAL associates a set of API credentials with a specific PayPal account
    // you can generate credentials from this https://developer.paypal.com/docs/classic/api/apiCredentials/
    // and convert to a p12 from terminal use :
    // openssl pkcs12 -export -in cert_key_pem.txt -inkey cert_key_pem.txt -out paypal_cert.p12
    soap.authorizationMethod = SOAP_AUTH_PAYPAL;
    soap.username = @"support_api1.your-username";
    soap.password = @"your-api-password";
    soap.clientCerficateName = @"paypal_cert.p12";
    soap.clientCertificatePassword = @"certificate-password";
    soap.responseHeader = YES;
    // use paypal for urn:ebay:api:PayPalAPI namespace
    [soap setValue:@"0" forKey:@"paypal:ReturnAllCurrencies"];
    // use paypal1 for urn:ebay:apis:eBLBaseComponents namespace
    [soap setValue:@"119.0" forKey:@"paypal1:Version"]; // ns:Version in WSDL file
    // certificate : https://api.paypal.com/2.0/ sandbox https://api.sandbox.paypal.com/2.0/
    // signature : https://api-3t.paypal.com/2.0/ sandbox https://api-3t.sandbox.paypal.com/2.0/
    [soap requestURL:@"https://api.paypal.com/2.0/"
          soapAction:@"GetBalance" completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {
          
        NSLog(@"Result: %@", dict);
        
    } failWithError:^(NSError *error) {
    
        NSLog(@"%@", error);
    }];
          	

Magento 2 login example :

	SOAPEngine *soap = [[SOAPEngine alloc] init];
    soap.selfSigned = YES; // only for invalid https certificates
    soap.responseHeader = YES;
    soap.actionNamespaceSlash = NO;
    soap.envelope = @"xmlns:urn=\"urn:Magento\"";
    [soap setValue:@"your-username" forKey:@"username"];
    [soap setValue:@"your-apykey" forKey:@"apiKey"];
    [soap requestURL:@"https://your-magentohost/api/v2_soap/"
          soapAction:@"urn:Mage_Api_Model_Server_V2_HandlerAction#login"
completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict)
	{
        NSLog(@"Login return: %@", [soap stringValue]);
        
    } failWithError:^(NSError *error) {
        
        NSLog(@"%@", error);
    }];

Upload file :

	SOAPEngine *soap = [[SOAPEngine alloc] init];

	// read local file
    NSData *data = [NSData dataWithContentsOfFile:@"my_video.mp4"];

	// send file data
    [soap setValue:data forKey:@"video"];
    [soap requestURL:@"http://www.my-web.com/my-service.asmx"
          soapAction:@"http://www.my-web.com/UploadFile"
          completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {
              
              NSLog(@"Result: %@", dict);
              
          } failWithError:^(NSError *error) {
    
              NSLog(@"%@", error);
          }];
          	

Download file :

	SOAPEngine *soap = [[SOAPEngine alloc] init];

	// send filename to remote webservice
    [soap setValue:"my_video.mp4" forKey:@"filename"];
    [soap requestURL:@"http://www.my-web.com/my-service.asmx"
          soapAction:@"http://www.my-web.com/DownloadFile"
          completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {
            
            // local writable directory
			NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
			NSString *filePath = [[paths firstObject] stringByAppendingPathComponent:@"my_video.mp4"];

			// the service returns file data in the tag named video
			NSData *data = dict[@"video"];
		    [data writeToFile:@"my_video.mp4" atomically:YES];
              
          } failWithError:^(NSError *error) {
    
              NSLog(@"%@", error);
          }];
          	

Optimizations


First of all, if you note a slowdown in the response of the request, try to change the value of the property named actionNamespaceSlash. After, when using the method named requestWSDL three steps are performed :

  1. retrieve the WSDL with an http request.
  2. processing to identify the soapAction.
  3. calls the method with an http request.

this is not optimized, very slow, instead you can use the optimization below :

  1. retrieving manually the SOAPAction directly from WSDL (once with your favorite browser).
  2. use the method named requestURL instead of requestWSDL without WSDL extension.

Install in your apps


With Cocoapods

Read the "Getting Started" guide

Cocoapods and Swift

Read the Integrating SOAPEngine with a Swift project

Standard installation

Read the "Standard Installation" guide

Licenses


Trial (simulator) Single App Enterprise (multi App)
TRIAL LICENSE BUY SINGLE LICENSE BUY ENTERPRISE LICENSE

Contacts


TWITTER FACEBOOK LINKED-IN

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].