GithubHelp home page GithubHelp logo

priore / soapengine Goto Github PK

View Code? Open in Web Editor NEW
482.0 29.0 75.0 51.07 MB

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

Home Page: http://www.prioregroup.com

License: Other

Swift 100.00%
soap apple-tv wsdl webservices wcf xml asp objective-c swift swift-package-manager

soapengine's Introduction

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 Apple TV apps that supports SOAP Client Protocol. This framework able executes methods at remote web services with SOAP standard protocol.

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

class ViewController: UIViewController, SOAPEngineDelegate {

	var soap: SOAPEngine = SOAPENgine()

	override func viewDidLoad() {
		soap.delegate = self
		soap.actionNamespaceSlash = true
		soap.setValue("Genesis", forKey: "BookName")
		soap.setIntegerValue(1, forKey: "chapter")

		// standard soap service (.asmx)
		soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
	    		soapAction: "http://www.prioregroup.com/GetVerses")
	}

	func soapEngine(_ soapEngine: SOAPEngine!, didFinishLoadingWith dict: [AnyHashable : Any]!, data: Data!) 
	{
		let dict = soapEngine.dictionaryValue()
		print(dict)
	}
}

with Block programming :

import SOAPEngine64

class ViewController: UIViewController {

	var soap: SOAPEngine = SOAPENgine()

	override func viewDidLoad() {
		super.viewDidLoad()
		soap.actionNamespaceSlash = true
		soap.setValue("Genesis", forKey: "BookName")
        	soap.setIntegerValue(1, forKey: "chapter")
        
        	soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
	    		    soapAction: "http://www.prioregroup.com/GetVerses",
		completeWithDictionary: { (statusCode: Int?, dict: [AnyHashable: Any]?) -> Void in
                            
			let book:NSDictionary = dict! as NSDictionary
			let verses = book["BibleBookChapterVerse"] as! NSArray
			print(verses)

		}) { (error: Error?) -> Void in
			print(error!)
		}
	}
}

with Notifications :

import SOAPEngine64

class ViewController: UIViewController {

	var soap: SOAPEngine = SOAPENgine()

	override func viewDidLoad() {
		super.viewDidLoad()

		NotificationCenter.default.addObserver(self, 
			selector: #selector(soapEngineDidFinishLoading(_:)), 
			name: NSNotification.Name.SOAPEngineDidFinishLoading, 
			object: nil)

		soap.actionNamespaceSlash = true
		soap.setValue("Genesis", forKey: "BookName")
		soap.setIntegerValue(1, forKey: "chapter")

		// standard soap service (.asmx)
		soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
	    	soapAction: "http://www.prioregroup.com/GetVerses")
	}

	@objc func soapEngineDidFinishLoading(_ notification: NSNotification) {
		let engine = notification.object as? SOAPEngine
		let dict = engine()
		print(dict)
	}
}

Synchronous request :

import SOAPEngine64

class ViewController: UIViewController {

	var soap: SOAPEngine = SOAPENgine()

	override func viewDidLoad() {
		super.viewDidLoad()
		soap.actionNamespaceSlash = true
		soap.setValue("Genesis", forKey: "BookName")
		soap.setIntegerValue(1, forKey: "chapter")

		// standard soap service (.asmx)
		do {
			let result = try soap.syncRequestURL("http://www.prioregroup.com/services/americanbible.asmx", 
						 soapAction: "http://www.prioregroup.com/GetVerses")
			print(result)
		}
		catch {
			print(error)
		}	
	}
}

settings for SOAP Authentication :

soap.authorizationMethod = .AUTH_BASICAUTH; // basic auth
soap.username = "my-username";
soap.password = "my-password";

settings for Social OAuth2.0 token :

// token authorization
soap.authorizationMethod = .AUTH_SOCIAL;
soap.apiKey = "1234567890"; // your apikey https://dev.twitter.com/
soap.socialName = ACAccountTypeIdentifierTwitter; // import Accounts

Encryption/Decryption data without SSL/HTTPS :

soap.encryptionType = ._ENCRYPT_AES256; // or SOAP_ENCRYPT_3DES
soap.encryptionPassword = "my-password";

Params with Attributes :

// book
var book = ["name": "Genesis"] as! NSMutableDictionary
var attr = ["order": "asc"]
// chapter
var child = soap.dictionary(forKey: "chapter", value: "1", attributes: attr)
book.addEntries(from: child!)
// 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>

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


Swift Package Manager

SOAPEngine is available as a Swift package. The repository URL is valid for adding the package in your app through the Xcode.

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
just simulator
Single App
single bundle-id
Enterprise
multi bundle-id
DOWNLOAD BUY 12,99€ BUY 77,47€

soapengine's People

Contributors

alexnauda avatar priore avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soapengine's Issues

Does SOAPEngine support WS-Discovery?

Does SOAPEngine support WS-Discovery?

I need to multicast a message such as this:

    <?xml version="1.0" encoding="UTF-8"?>
    <e:Envelope xmlns:e="http://www.w3.org/2003/05/soap-envelope"
    xmlns:w="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery"
    xmlns:dn="http://www.onvif.org/ver10/network/wsdl">
    <e:Header>
    <w:MessageID>uuid:84ede3de-7dec-11d0-c360-f01234567890</w:MessageID>
    <w:To e:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To>
    <w:Action a:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action>
    </e:Header>
    <e:Body>
    <d:Probe>
    <d:Types>dn:NetworkVideoTransmitter</d:Types>
    </d:Probe>
    </e:Body>
    </e:Envelope>

Null parameters in javax-ws service

Hello priore,
I'm doing some tests on the simulator and can not consume services in javax-ws requiring parameters in the methods (including primitive values​​). All parameters null arrive on the server. Methods without parameters work normally. Is there any specific configuration required? Services in .Net run smoothly.

Add CDATA tag to request parameters

Is there a way to add the CDATA tag to parameters that you add to your request? Or do we have to manually do this? We had a string that contained an ampersand (&) and was causing the request to fail.

FAIL

[soap setValue:"Tarzan & Jane arrived back at the island." forKey:@"Comments"];

SUCCESS

[soap setValue:"Tarzan and Jane arrived back at the island." forKey:@"Comments"];

Is there a way to add an attribute like...

[soap setValue:"Tarzan & Jane arrived back at the island." forKey:@"Comments" encloseCDATA:true];

instead of having to do this:

[soap setValue:"<![CDATA[Tarzan & Jane arrived back at the island.]]>" forKey:@"Comments"];

Wrong password digest

Hi @priore ,

I'm using ws-security password digest, and I found the digest may be wrong.

SOAPEngine generated following xml:
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">NDY3ZDM0ZTU2NDAzNjc4Njg4YmJlODRmY2E1MWUzYTk3ZDQxYzM2Zg==/wsse:Password<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MEQ0RDJDQkIzMjM4NEMxODg1QkUwMDU5NDZEMTZERUM=/wsse:Noncewsu:Created2015-01-15T03:33:24Z/wsu:Created

the digest was: NDY3ZDM0ZTU2NDAzNjc4Njg4YmJlODRmY2E1MWUzYTk3ZDQxYzM2Zg==

But my server (CXF) calculated out digest was: WvY1DPYdw/xcQKvULVEvREXx2wg=

They are different.

I also confirmed this issue by soapui.

So, could you please check this out?

Thanks!

Call WebService on Apache CXF

Hi, i'm trying to call a webservice on Apache CXF in Swift with SOAPEngine. I dont have errors, but my dictionary is empty...
Here's the Swift code for calling my WS

    var soap = SOAPEngine()
    soap.userAgent = "SOAPEngine"
    soap.actionNamespaceSlash = true

    soap.setValue("Julien", forKey: "pwd")
    soap.setValue("Bonjour", forKey: "login")
    soap.requestWSDL("http://localhost:8080/Xqui/services/WSProject?WSDL",
        operation: "http://interfaces.webservices.project.generycs.be/test1",
        completeWithDictionary: { (statusCode : Int, dict : [NSObject : AnyObject]!) -> Void in
            var logInfo:Dictionary = dict as Dictionary
            var nb = logInfo.count
            NSLog("%@", dict)

        }) { (error : NSError!) -> Void in
            NSLog("%@", error.description)
    }

Here's the java code of my WS: a simple method for test
(We must specify namespace for webparam, otherwise the call fails)

@WebMethod
public String test1(@WebParam(name = "login", targetNamespace =  "http://interfaces.webservices.project.generycs.be/") String login, @WebParam(name = "pwd", targetNamespace = "http://interfaces.webservices.project.generycs.be/") String pwd) throws Exception
{

    log.debug("<<<< WsProject.test1 - start  - login = " + login);
    return login.toUpperCase() + "-" + pwd;
}

Thanks in advance,

Julien

64-bit support

It seems that building for 64-bit architecture doesn't work.

ld: warning: ignoring file ./SOAPEngine.framework/SOAPEngine, missing required architecture x86_64 in file ./SOAPEngine.framework/SOAPEngine (3 slices)

This means we won't be able to build for iPhone 5S

Installing

Hi, maybe my question will be easy but I need help.

I am trying to add SOAPEngine to my current project with a Podfile like this:

platform:ios, '7.0'
pod ’SOAPEngine’ ‘~> 1.21.0’

but I got error. Could you tell me what is the correct podfile content?

Download/Upload progress

Hello Priore, I'm using SOAPEngine and it's helping me a lot. Congrats, it's a really good job.
I have a question that actually is a request. Does SOAPEngine use NSURLConnection class to do web communication? If Yes, is it possible to get download/upload progress (via float type property)? It would be an alternative way to obtain request progress, as we do with "connection: (NSURLConnection *) connection didReceiveData: (NSData *) data" method implementing "NSURLConnectionDataDelegate"

Hello,I set the header with some string, but is always nil ! Can you help me

//-----------------code

SOAPEngine *soap = [SOAPEngine sharedInstance];

soap.header = [NSString stringWithFormat:@"<TicketHead xmlns=\"http://tempuri.org/\">"
                                        "<ticket>someString</ticket>"
                                        "</TicketHead>"];

[soap requestURL:defaultWebServiceUrl soapAction:soapAction value:value complete:^(NSInteger statusCode, NSString *stringXML) {
    NSLog(@"statusCode : %ld  , stringXML : %@",(long)statusCode,stringXML);
} failWithError:^(NSError *error) {
    NSLog(@"error : %@",error);
}];
NSLog(@"---->%@",soap.header);

//---------------Output
Printing description of soap->_xmlRequest:
< ?xml version="1.0" encoding="utf-8"? >< soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >< soap:Header > I want to add something in here < /soap:Header >< soap:Body >< Login xmlns="http://tempuri.org" >< input >< pwd >< /pwd >< userId >< /userId >< /input >< /Login >< /soap:Body >< /soap:Envelope>
2014-10-16 11:27:54.147 workflowapp[20400:2849073] ---->
2014-10-16 11:27:56.223 workflowapp[20400:2849073] statusCode : 200 , stringXML : < ?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 > < LoginResponse xmlns="http://tempuri.org/">< LoginResult >false< /LoginResult >< /LoginResponse > < /soap:Body>< /soap:Envelope>

Getting attributes from the XML tag?

Given I have the following response body:

<GetAllUsersResponse>
  <GetAllUsersResult>
    <User ID="1">
      ..
    </User>
    <User ID="2">
      ..
    </User>
  <GetAllUsersResult>
</GetAllUsersResponse>

Is there a way I can get the users' IDs from the dictionary that SOAPEngine returns? Or do I have to roll my own parser for this kind of use-case?

Error Domain=NSURLErrorDomain Code=-1012 after upgrading to SoapEngine64

Hi,
i tried to upgrade my project to use the SoapEngine 64 Framework (I used the 32 bit version in the past).
Now I get a NSURLErrorDomain -1012 and a weird NSErrorFailingURLKey Error. I did`t changed anything in the code but the deprecated methods :

(void)requestURL:(id)asmxURL
soapAction:(NSString *)soapAction
complete:(SOAPEngineCompleteBlock)complete
failWithError:(SOAPEngineFailBlock)fail

to

  • (void)requestURL:(id)asmxURL
    soapAction:(NSString *)soapAction
    completeWithDictionary:(SOAPEngineCompleteBlockWithDictionary)complete
    failWithError:(SOAPEngineFailBlock)fail;

I really can`t get it work, is there any trick or did I miss something?

Support for quotes around soap action in header.

I need for the soap action in the header to have quotes around it. If I put them in the action string, then the rest of the XML gets parsed incorrectly. I would be good if you could make it smart about removing quotes from the beginning and end of the soap action string. Or it could have some optional property for wrapping the soap action in the header with quotes.

It would also be nice to give authorization parameters or at least be able to set a value for an authorization header. I worked around this by subclassing SOAPEngine and implementing the willSendRequestForAuthenticationChallenge: method. Doing this is okay but it doubles the number of requests.

I did pay for a license, and for now I can't use it because of the soap action issue.

NSURLConnection Memory Leak

Hey!

I've just tested your SOAPEngine framework. So far it's a very good framework and it works as expected. :) But it seems that there is a NSURLConnection memory leak on every call of [SOAPEngine requestURL:soapAction:]. I'm using the - (void)requestURL:(id)asmxURL soapAction:(NSString*)soapAction complete:(SOAPEngineCompleteBlock)complete failWithError:(SOAPEngineFailBlock)fail; function. Could you take a look at this, please? :)

Regards,
Gregor

bildschirmfoto 2014-10-27 um 17 03 47
bildschirmfoto 2014-10-27 um 17 04 04

using requestWSDL failed and got 415 issue

Hi
I have using your soapengine to request a Url from my sever, however i always got the error 415 when parsing the data.

here is the soap object that i have generate.
image

and the block finish with failwitherror and the error shows that invaild WSDL format.
image

can you help me with this error.

Thanks a lot

How to use the framework with w3schools web services

    SOAPEngine *soap = [[SOAPEngine alloc] init];
    soap.userAgent = @"SOAPEngine";
    soap.licenseKey = @"your-license-code";
    soap.actionNamespaceSlash = YES;

    // w3schools Celsius to Fahrenheit
    [soap setValue:@"30" forKey:@"Celsius"];
    [soap requestURL:@"http://www.w3schools.com/webservices/tempconvert.asmx"  
        soapAction:@"http://www.w3schools.com/webservices/CelsiusToFahrenheit" 
        complete:^(NSInteger statusCode, NSString *stringXML) {

        NSLog(@"Result: %f", [soap floatValue]);

    } failWithError:^(NSError *error) {

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

Paid version doesn't work

Hello!

I've already payed for the SOAPEngine, put the license code I received on soap.licenseKey with the exact bundle id that I provide you, but it still show the demo popup. Can you help?

Thanks

Usage

Hello

i'm trying to communicate with a SOAP API on Kozzi web service i need to generate this kind of xml with SOAPEngine and im completely lost here is the xml that needs to be generated, also i got just 1 url where this needs to be submitted i dont know what these 2 params mean

[soap requestURL:@"https://secure.kozzi.com/soap-server?wsdl" soapAction:@""];

https://secure.kozzi.com/soap-server?wsd - this is wsdl desc
https://secure.kozzi.com/soap-server - this is the url where functions are called, see in the xml is called getBalance

env:Body username password /ns1:getBalance /env:Body /env:Envelope

this comment xml / html paste in github is a crap :)))

"extra argument "value" in call" Warning in Swift

Swift:
soap.requestWSDL("http://59.77.16.52:8080/axis2/services/TestService?wsdl",
operation: "test",
value: "much",
forKey: "name",
completeWithDictionary: {(statusCode : NSInteger,idc : NSDictionary)in
println(" ")
},
failWithError: {(error: NSError) in
println(" ")})

extra argument "value" in call????
OC:
OC method : - (void)requestWSDL:(id)wsdlURL
operation:(NSString )operation
value:(id)value
forKey:(NSString
)key
completeWithDictionary:(SOAPEngineCompleteBlockWithDictionary)complete
failWithError:(SOAPEngineFailBlock)fail;

Asynchronous / Synchronous call

Hi ! Is there a way to make an Synchronous call with the framework ?
Otherwise, how can i implement a callback function ?

Regards

SOAPEngine sometimes crash with error [__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'

Hi.

I've installed this framework with cocoapods (v1.2).

Using this code, SOAPEngine crashes with the error : [__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'

Here's the code that crashes :

    NSDictionary *params = @{@"email": user.email,
                             @"token": user.token};
    SOAPEngine *soap = [[SOAPEngine alloc] init];
    soap.userAgent = @"SOAPEngine";

    // service url with WSDL, and operation (method name) without tempuri
    [soap requestWSDL:@"http://myserver.com/wsdl"
            operation:@"my_service"
                value:params
    completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {

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

    } failWithError:^(NSError *error) {

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

Maybe the crash comes from a wrong server response (since the server belongs to my client, I do not have access to it), but how could I test this response without crashing?

Is SSL supported?

I'm trying to use SOAPEngine for a web service that runs on SSL and I'm getting the following error:
The operation couldn't be completed. (NSURLErrorDomain error -1012.).

Removing https and replacing it with just http works.

Encoding failure in body

I tried to use soap.setValue(" asd ", forKey: "id_list")

but when i print soap._xmlRequest i get

soap:Body<id_list><id> asd </id></id_list>/soap:Body

this <id> asd </id> instead of asd

Does your library support the https request?

I am having in the trouble with using the https request. I'd like to know that does your library supports https request?

This is an error message: Printing description of error:
Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed.

64bit build & XML parser error

Hey (yes, me again) ;)

At first, thanks for your v1.9 update! This version should fix the memory leaks issue (#14). I have also bought a license of your framework! :)

But it seems that the last framework build for the 64 Bit architecture (SOAPEngine64.framework) was not really build for 64 bit. Since version v1.9 i get the following linker error while building my app for arm64 architecture:

ld: warning: ignoring file /Users/Me/Documents/Projects/SOAPEngine/SOAPEngine64.framework/SOAPEngine64, missing required architecture x86_64 in file /Users/Me/Documents/Projects/SOAPEngine/SOAPEngine64.framework/SOAPEngine64 (4 slices)

And there is one more small issue since version 1.9:
I get a XML parser error (in the console window) after each response (but this doesn't affect the further execution of my app). Here is an example XML response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <ns1:iPadGetNewsResponse xmlns:ns1="urn:TransferCenteriPad">
         <Enc_return xsi:type="xsd:string">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgcGxpc3QgUFVCTElDICItLy9BcHBsZS8vRFREIFBMSVNUIDEuMC8vRU4iICJodHRwOi8vd3d3LmFwcGxlLmNvbS9EVERzL1Byb3BlcnR5TGlzdC0xLjAuZHRkIj48cGxpc3QgdmVyc2lvbj0iMS4wIj48ZGljdD48a2V5Pkxhc3RVcGRhdGVkPC9rZXk+PHN0cmluZz4yMDE0LTExLTEwIDEzOjI1OjQ3PC9zdHJpbmc+PC9kaWN0PjwvcGxpc3Q+</Enc_return>
      </ns1:iPadGetNewsResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
:1: parser error : Start tag expected, '<' not found
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgcGxpc3QgUFVCTElD
^

But there seems no error in the responding XML :/

If I reset my local git branch of your framework to the version 1.8 i don't have those issues. Would you please have another look at it? Thanks! :)

Gregor

how to use the SOAPEngine framework

Hello, priore
I used the project SOAPEngine_Sample you provided to access http://www.nanonull.com/TimeService/TimeService.asmx, when I called getCityTime,status code 200 was returned by http request. But the returned data were not correct, and I do not know how to fix it. How can I buy your product?
The following is part of my code:
soap = [[SOAPEngine alloc] init];
//soap.userAgent = @"SOAPEngine";
soap.delegate = self;
soap.version = VERSION_1_1;
[soap setValue:@"BOSTON" forKey:@"city"];
[soap requestURL:@"http://www.nanonull.com/TimeService/TimeService.asmx" soapAction:@"http://www.Nanonull.com/TimeService/getCityTime"];

Under ws-security mode, SOAPEngine treats local datetime as GMT datetime

Hi, I got a problem and need your help.

I'm using ws-security in my soap request, but server always returns a error: "The message has expired". Turns out that SOAPEngine treats local datetime as GMT datetime.

my code likes:
SOAPEngine *soap = [[SOAPEngine alloc] init];
soap.userAgent = @"SOAPEngine";
soap.version = VERSION_1_1; // WCF service (.svc)
soap.authorizationMethod = SOAP_AUTH_WSSECURITY;
soap.username = @"[email protected]";
soap.password = @"1234";

here is the segment from request payload:

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">wsse:[email protected]/wsse:Username<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">ODZiMDE4ZmQ2NDQ5NTRlODYxNmQwMjBmYThjNDMwNzgwMzk4ZGY2NA==/wsse:Password<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">RDIyRkRDM0Y2REE0NEEyREFGQkI1REFFRDUwOTMyRTA=/wsse:Noncewsu:Created2015-01-12T18:57:20Z/wsu:Created/wsse:UsernameToken/wsse:Security

I'm in timezone +8, and the time is 2015-01-12T18:57:20, but you can see the wsu:Created2015-01-12T18:57:20Z/wsu:Created says this is a GMT datetime.

So, could you please tell me what I can do to fix this? thank you so much.

what are the limitations of the trial version?

Im testing an app with the trial version and it works well. I would like to know what are the limitations.

I'm also thinking to buy the complete version. how do you send it the framework? source code or a framework?
how does it work with updates too, do you keep compiling it for new arm processors, new ios features etc, swift?

How can I submit a two-dimension?

I've charged your framework and it's very nice I think. However we are in the trouble in the error that soap engine fire out.

The message "SOAPEngine Cannot use object of type stdClass as array"

Our services is receiving a two-dimension array and the data type in the SOAP is "xsd:string[][]" and this is the struct.

<urn:greenapicatalogCategorySubmitReviewByProductID soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <sessionId xsi:type="xsd:string">?</sessionId>
   <customer_id xsi:type="xsd:int">?</customer_id>
   <comment xsi:type="xsd:string">?</comment>
   <questions xsi:type="urn:greenapicatalogCategoryProductReviewArray" soapenc:arrayType="xsd:string[][]"/>
   <photo1 xsi:type="xsd:string">?</photo1>
   <photo2 xsi:type="xsd:string">?</photo2>
   <photo3 xsi:type="xsd:string">?</photo3>
   <customer_ip xsi:type="xsd:string">?</customer_ip>
   <webform_id xsi:type="xsd:int">?</webform_id>
</urn:greenapicatalogCategorySubmitReviewByProductID>

Could you help us? This is a urgent question because our project is coming to deadline. Thank for your help?

Deserializing parameter problem

Hi all, I have a problem with calling webservise with parameter. The situation is as follows:

When execute this code :

soap.userAgent = "SOAPEngine"
actionNamespaceSlash = true
soap.version = VERSION_1_1
soap.setValue(2, forKey: "Lang")

soap.requestURL("http://www.vitajtevtrnave.sk/miscellaneous/webservice.cfc",      
                            soapAction:"GetWholeDatabase", 
                            completeWithDictionary: { (status: Int, dict: [NSObject : AnyObject]!) -> Void in

                             var result:Dictionary = dict as Dictionary
                                    println(result)

                             }) { (error:NSError!) -> Void in

                                     println(error)
                            }

I get error message:

SOAPEngine org.xml.sax.SAXException: Deserializing parameter 'Lang':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
Error Domain=NSOSStatusErrorDomain Code=0 "org.xml.sax.SAXException: Deserializing parameter
'Lang':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType" 
UserInfo=0x7ffac9d441b0 {NSLocalizedDescription=org.xml.sax.SAXException: Deserializing parameter 'Lang':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType}

Soap message from SoapUI:

  soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"    
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mis="http://miscellaneous">
  soapenv:Header
  soapenv:Body
      mis:GetWholeDatabase soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      Lang xsi:type="xsd:int">2
      mis:GetWholeDatabase
  soapenv:Body
  soapenv:Envelope

When use action without parameter everything works. Could anyone help me ? where may be a bug ?

Thanks

SOAPEngine operations in NSOperationQueue?

Hi again,

I'm trying to make a multiple requests to a single web service endpoint. I'm doing this by queuing up these requests in a NSOperationQueue. The problem is that when I get to the completWithDictionary handler of requestWSDL method, I get the same result from the last operation in the queue.

To better explain my problem, here's an example.

// A dummy webservice
let url = "https://some.url.com/webservices/WebService.asmx?WSDL"

let queue = NSOperationQueue()
let restaurantIds = [100, 101]

for id in restaurantIds {

  let operation = NSBlockOperation()

  operation.addExecutionBlock({ () -> Void in
    if !operation.cancelled {
      let soap = SOAPEngine.sharedInstance()
      soap.setValue(id, forKey: "RestaurantID") // The value of `id' here is correct; 100, and then 101
      soap.requestWSDL(url,
        operation: "SomeOperation", // A dummy operation
        completeWithDictionary: { (statusCode: Int, response: [NSObject: AnyObject]!) -> Void in
          // When I try to access `id' here, it's always 101 when it should be 100 
          // then 101 on the second.
        }
      )
    }
  })

  queue.addOperation(operation) // Starts the operation

}

I think this has something to do with the way you handle completion blocks inside SOAPEngine, but I could be wrong.

It seems that the completion block for the first operation isn't called; instead, it fires the completion block for the second operation for both.

RequestURL Block Deprecated

I 'm getting the following Warning in IOS 8 :

"requestURL:soapAction:complete:failWithError is deprecated"

Is it a problem? its compile and run...

SetValue Problem

Hi, i have a strange problem here. This my code...

Usuarios *usuario = [db getDataFromUserTable];

for (Pedidos *p in arrayPedidos)
{
    // INICIALIZA O OBJETO SOAP.
    soap = [[SOAPEngine alloc] init];
    soap.userAgent = @"SOAPEngine";
    soap.licenseKey = kSOAP_ENGINE_KEY;
    soap.version = VERSION_WCF_1_1; // WCF service (.svc)

    [soap setValue:usuario.usuarioUID forKey:@"aparelhoUID"];
    [soap setValue:p.pedidoID forKey:@"NumeroPedido"]; // THIS IS NSNUMBER AND WORKS 
    [soap setValue:p.nomeGerenteLoja forKey:@"NomeGerenteLoja"];
    [soap setValue:p.emailLoja forKey:@"EmailLoja"];
    [soap setValue:p.nomeAprovadorLoja forKey:@"AutorizadoPor"];
    [soap setValue:p.qtdOcorrenciasRegistradas forKey:@"QuantOcorrRegistrada"]; // THIS  IS NSNUMBER AND NOT WORKS.
    [soap setValue:p.statusID forKey:@"StatusPedido"];  // THIS IS NSNUMBER AND NOT WORKS. 

    NSError *error = nil;
    [soap syncRequestURL:kBASE_URL_ARTSERVICES
              soapAction:@"http://smart.artservices.com.br/IPositivacao/UploadDadosPedido" error:&error];

    if (error != nil)
    {
        return;
    }

    if ([[soap stringValue] isEqualToString:@"true"])
    {
        NSLog(@"STATUS: UPLOAD PEDIDO ID: %@ -- OK --",p.pedidoID);
        p.isSync = [NSNumber numberWithBool:TRUE];

        if(!([self.managedObjectContext save:&error]))
        {
            // Handle Error here.
            NSLog(@"LOG: %@", [error localizedDescription]);
        }
    }
    else
    {
        NSLog(@"STATUS: UPLOAD ERROR!");
        NSLog(@"ERRO UPLOAD PEDIDO ID: %@,",p.pedidoID);
    }
}

The parameters with receive NSNumber values in this code, the last two of them, arrive with value '0' in my server.
But the first one (p.pedidoID) arrive with correct value in my server.
I Try use setIntergerValue buts it's show the same problem. In my server it waits a int32 for the last 2 parameters. I`m doing something wrong?

Setting custom header?

Hi, I need to be able to do the following request. I also need that header to be added on every succeeding request.

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Header>
        <AuthHeader xmlns="https://some.xmlns_url_here.com/webservices/WebService">
            <Token>SOME_AUTH_TOKEN_HERE</Token>
        </AuthHeader>
    </Header>
    <Body>
        ...
    </Body>
</Envelope>

How can I do this using SOAPEngine? I'm fairly new to SOAP even though it's been around for ages, so please bear with me. :)

I terrifically need some help

Service URL: http://..removed../LotteryWS.dll
Method name: GetLottery
EntityID: 2
Password: Smart@Winners
LotteryId: 10

I'm trying with following Swift implementation - but the complete event always returns me the service URL HTML page :( can you help to determine the problem area I'm in probably (?)


var soap = SOAPEngine()
soap.userAgent = "SOAPEngine"
soap.actionNamespaceSlash = true
soap.responseHeader = false // use only for non standard MS-SOAP service
//soap.version = VERSION_1_1

soap.setIntegerValue(2, forKey: "EntityID")
soap.setValue("Smart@Winners", forKey: "Password")
soap.setIntegerValue(10, forKey: "LotteryId")

soap.requestURL("http://..removed../LotteryWS.dll",
            soapAction: "http://..removed../GetLottery",
            completeWithDictionary: { (statusCode : Int, dict : [NSObject : AnyObject]!) -> Void in

                var book:Dictionary = dict as Dictionary
                NSLog("%@", book)

            }) { (error : NSError!) -> Void in

                NSLog("%@", error)
        }

If I manually run the method by reaching to the service URL with given parameters then I can see it returns values.

Not work in thread.

The library doesn't seem to work when its functions are executed within a thread. When they are executed within the main thread everything works fine, however.
Does your library support ARC?

When installing though CocoaPods got build error

The file "MyApp.app" couldn’t be opened because you don’t have permission to view it.

that's the error I got after installing SOAPEngine pods. I tried everything and I cannot make it build. Any ideas ?

I tried this following links :

http://stackoverflow.com/questions/5478480/xcode-4-0-1-dont-have-permission-to-view-old-project-file-help
http://stackoverflow.com/questions/24924809/the-file-myapp-app-couldnt-be-opened-because-you-dont-have-permission-to-vi

Dictionary with two equal keys

Hi,

We have an issue, we want to make a request with the following xml:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://server.ws.winparf.lite.com/">
     <soap:Header></soap:Header>
     <soap:Body>
          <ser:getPagedListByFilter>
               <filter>
                  <prenom>remi</prenom>
                    <prenom>bertrand</prenom>
                    <prenom>clement</prenom>
                     <prenom>joan</prenom>
                </filter>
                <pageSize>50</pageSize>
                <mode>disjunction</mode>
                <page>1</page>
           </ser:getPagedListByFilter>
      </soap:Body>
</soap:Envelope>

So, we need to add multiple dictionary with the same key ("prenom"). How do we do that?

Thanks in advance,

Digest AuthType

Is it possible to access a SOAP Service behind a digest authenticated Apache Server?

Regard Andreas

Delegate method Vs Block Method

I have an example where I'm using the delegate method.
It produces the following XML code (sensitive data has been blanked out)

<?xml version="1.0" encoding="utf-8"?>
<soap12:envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:header>
    </soap12:header>
    <soap12:body>
        <checkpermissions xmlns="http://tempuri.org/">
            <username>
                [email protected] 
            </username>
            <password>
                XXXXXXX 
            </password>
            <msg xsi:nil="true" /><securityticket xsi:nil="true" /> 
            <iuserid>
                0 
            </iuserid>
            <utcoffset>
                360000000000 
            </utcoffset>
        </checkpermissions>
    </soap12:body>
</soap12:envelope>

which returns a valid response.

I then tried to convert it to using a block which generates the following XML (sensitive data blanked out)

<?xml version="1.0" encoding="utf-8"?>
<soap12:envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:header>
    </soap12:header>
    <soap12:body>
        <checkpermissions xmlns="http://tempuri.org/">
            <input>
                <username>
                    [email protected]
                </username>
                <password>
                    XXXXXXX
                </password>
                <msg xsi:nil="true" /><securityticket xsi:nil="true" />
                <iuserid>
                    0
                </iuserid>
                <utcoffset>
                    360000000000
                </utcoffset>
            </input>
        </checkpermissions>
    </soap12:body>
</soap12:envelope>

which returns an error because of the added <input></input> tags.

Why does the block programming method insert the extra <input></input> tags? and is there a way to disable it?

Code for the delegate method

SOAPEngine *soap = [[SOAPEngine alloc] init];
soap.delegate = self;
soap.userAgent = @"SOAPEngine";
soap.actionNamespaceSlash = YES;
soap.replaceNillable = YES;
soap.selfSigned = YES;
soap.responseHeader = YES;
soap.userAgent = @"SOAPEngine";
soap.version = VERSION_1_2;


[soap setValue:@"[email protected]" forKey:@"UserName"];
[soap setValue:@"XXXXXXX" forKey:@"Password"];
[soap setValue:nil forKey:@"Msg"];
[soap setValue:nil forKey:@"SecurityTicket"];
[soap setIntegerValue:0 forKey:@"iUserID"];
[soap setValue:utcOffset forKey:@"UtcOffset"];
[soap requestURL:@"https://server.website.net/security.asmx"
          soapAction:@"http://tempuri.org/CheckPermissions"];

Code for the block method

MyObject *myObject = [[MyObject alloc] init];
    myObject.UserName = @"[email protected]";
    myObject.Password = @"XXXXXXX";
    myObject.Msg = nil;
    myObject.SecurityTicket = nil;
    myObject.iUserID = 0;
    myObject.UtcOffset = utcOffset;


    SOAPEngine *soap = [[SOAPEngine alloc] init];
    soap.delegate = self;
    soap.userAgent = @"SOAPEngine";
    soap.actionNamespaceSlash = YES;
    soap.replaceNillable = YES;
    soap.selfSigned = YES;
    soap.responseHeader = YES;
    soap.userAgent = @"SOAPEngine";
    soap.version = VERSION_1_2;

    [soap requestURL:@"https://server.website.net/security.asmx"
          soapAction:@"http://tempuri.org/CheckPermissions"
               value:myObject completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {
                   NSLog(@"%@", dict);
               } failWithError:^(NSError *error) {
                   NSLog(@"%@", error);
               }];

Thanks.

Message Composition

Hi all I have example of soap message:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" <xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
   <soapenv:Body>
      <tem:ReceiveMessage>
           <tem:request>
            <tem:MessageContainer>
               <Object Id="" Name="" Description="" Class="" IsSigned="" MimeType="" Encoding="">
               </Object>
            </tem:MessageContainer>
         </tem:request>
      </tem:ReceiveMessage>
   </soapenv:Body>
</soapenv:Envelope> 

My question is how to set xmlns:tem="http://tempuri.org/" and attribute for element Object like Id, Name, Description.

This is structure of Object from WSDL:

  <xs:complexType mixed="true" name="object">
    <xs:sequence>
      <xs:any maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:string"/>
    <xs:attribute name="Name" type="xs:string"/>
    <xs:attribute name="Description" type="xs:string"/>
    <xs:attribute name="Class" type="xs:string"/>
    <xs:attribute name="IsSigned" type="xs:boolean"/>
    <xs:attribute name="MimeType" type="xs:string"/>
    <xs:attribute name="Encoding" type="tns:encoding" use="required"/>

I trying compose this message, there is my code:

        var object:NSDictionary = ["Object":"anyType"]
        var request:NSDictionary = [ "MessageContainer":object]
        
        var soap = SOAPEngine()
        soap.delegate = self
        //soap.envelope = "xmlns:tem=\"http://tempuri.org/"   HTTP operation error statusCode: 400
        soap.userAgent = "SOAPEngine"
        soap.version = VERSION_1_1
       soap.setValue(request, forKey: "request")
        soap.requestWSDL("xxx/receiveMessage?wsdl", operation: "ReceiveMessage")

This is my result XML:

 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" /> 
<soap:Header> </soap:Header> 
 <soap:Body> 
     <ReceiveMessage xmlns="http://tempuri.org/IMessage"> 
          <request>
               <MessageContainer>
                    <Object>xs:any and attribute</Object>
               </MessageContainer> 
          </request>
      </ReceiveMessage>
</soap:Body>
 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.