Compare commits

...

119 Commits

Author SHA1 Message Date
1fa5c8a15e Mark client generated services as public 2022-02-23 15:13:04 +01:00
813dd52d70 Update dependency injection for Symfony 4.* 2022-02-09 09:47:50 +01:00
8a40d23a94 Use laminas/laminas-mime instead of zendframework/zend-mime 2022-02-08 16:03:13 +01:00
5d335f2ca9 Correction de l'écriture du xml 2020-07-15 12:35:40 -04:00
9d6468d0a6
Update composer.json 2020-07-15 11:25:49 -04:00
9786f291b0
Update composer.json 2020-07-15 11:25:04 -04:00
750db6692b
Update composer.json 2020-07-15 11:24:05 -04:00
Mimir
9f7b7f40b8
Merge pull request #4 from Cadoles/develop
Add minOccurs annotation support on complexType
2020-07-15 16:29:05 +02:00
Mimir
87947a1e7b
Merge branch 'mse' into develop 2020-07-15 16:26:24 +02:00
e024833d48 Add minOccurs annotation support on complexType 2020-07-15 16:16:25 +02:00
fc44014790 Définition timeout curl a 10 secondes 2019-10-24 16:34:14 -04:00
7ba9c4048c Nouvelle méthode de validation des WSDL 2019-10-10 15:20:59 -04:00
f0733bd671 Nouvelle méthode de validation des WSDL 2019-10-10 15:17:16 -04:00
f5e1be09de Merge branch 'mse' of github.com:Cadoles/BeSimpleSoap into mse 2019-10-10 15:16:24 -04:00
df3d75047f Nouvelle méthode de validation des WSDL 2019-10-10 15:16:10 -04:00
87350704d3
Merge pull request #2 from Cadoles/issue#1
vérification fichier de cache vide ou xml erronné
2019-09-24 09:19:38 -04:00
85f86469ab Merge OK 2019-09-24 09:17:28 -04:00
e1a35d1e1e Vérification fichier de cache vide ou xml erronné 2019-09-24 08:54:47 -04:00
30850d7a01
Merge pull request #3 from Cadoles/php-cs-fixer
Passe générale php-cs-fixer
2019-09-24 08:50:42 -04:00
77403fcfbb Suppression fichier de cache cs-fixer 2019-09-24 08:45:47 -04:00
dc63ba20e4 ajouter fichier de cache cs-fixer au gitignore 2019-09-24 08:43:49 -04:00
dad2b76165 Passe générale php-cs-fixer 2019-09-24 08:23:19 -04:00
a1695680ae Signature de Response iso PROD 2019-09-20 12:10:09 -04:00
95706abbd7 Retour à une signature iso PROD 2019-09-19 15:29:04 -04:00
6d5f9ff9e5 Show null attributes in response
Partially revert changes from d1f5c1f6740121751754644c1123d97717fe5035 and fea1093bed108392caf4388b191d7c902a43838a
2019-09-16 16:41:21 +02:00
914acccf1d Ignore .php_cs.cache files 2019-09-12 11:45:48 +02:00
0c94185907 Revert "Fix Dumper. Each complext type is now wrapped inside container element tag"
This reverts commit 7802a0d19fb4fe1c5ad2f8b180f19649c52854cd.
2019-09-12 11:44:47 +02:00
aa0b750f47 Revert "Array support change"
This reverts commit 3f2a99adf6133910f36bf00f19a57accb59e1e40.
2019-09-12 11:43:53 +02:00
Tim Timmermans
cc83e1e6db Add support for "overriden" routes 2019-08-06 11:59:02 +02:00
Tim Timmermans
412e7f16c9 Reverted default definition style to RPC. 2019-08-06 11:58:51 +02:00
Tim Timmermans
729a2bc8df Fix dumper in order to generate a valid WSDL 2019-08-06 11:58:35 +02:00
BohwaZ
b8bf76aeb9 fixup! Update README, add back some instructions on how to use 2019-08-06 11:07:42 +02:00
BohwaZ
a3d691261c Update README, add back some instructions on how to use 2019-08-06 11:04:18 +02:00
BohwaZ
6cf62100a4 ext-mcrypt is not necessary and is not included in PHP anymore 2019-08-06 11:03:54 +02:00
Tim Timmermans
2e9dc9a34d Fix issue that each method param overrides the initial input message. 2019-08-06 10:57:16 +02:00
BohwaZ
95a91bb8bb Those tests don't have any value as depending on different PHP versions, the headers can slightly change 2019-08-06 10:48:46 +02:00
BohwaZ
ec0004ea36 Revert "Fix error handling"
This reverts commit ef81da77ea25d78cf55408fde3e7919f60faff3e.
2019-08-06 10:28:55 +02:00
BohwaZ
00101ff7fb Restore package name after merging back changes of cocciagialla fork 2019-08-06 10:26:19 +02:00
Gianluigi 'cocciagialla' Mammarella
ef81da77ea Fix error handling 2019-07-03 01:08:36 +02:00
Gianluigi 'cocciagialla' Mammarella
54e9e0ed05 Remove SOAP-ENC 2019-06-27 13:40:00 +02:00
Gianluigi 'cocciagialla' Mammarella
679b44ba13 Use encoded instead of literal 2019-06-27 13:08:26 +02:00
Gianluigi 'cocciagialla' Mammarella
a7a49b793a Add minOccurs and maxOccurs into wsdl dumper 2019-06-26 19:22:09 +02:00
Gianluigi 'cocciagialla' Mammarella
d1f5c1f674 Remove from response the nillable elements. Fix namespace declaration in the xml response 2019-06-26 19:03:56 +02:00
Gianluigi 'cocciagialla' Mammarella
fea1093bed Remove from response the nillable elements. Fix namespace declaration in the xml response 2019-06-26 18:53:59 +02:00
Gianluigi 'cocciagialla' Mammarella
9fc58e4388 Replace SOAP-ENV with soap as soap-envelope ns prefix 2019-06-24 19:05:43 +02:00
Gianluigi 'cocciagialla' Mammarella
a7c610b767 Add hexBinary type 2019-04-15 18:20:57 +02:00
Gianluigi 'cocciagialla' Mammarella
2b8f75b4ae Fix wsdl for array complex type 2019-04-11 10:33:17 +02:00
Gianluigi 'cocciagialla' Mammarella
6718703ba5 Add headers binder for document 2019-04-10 07:31:37 +02:00
Gianluigi 'cocciagialla' Mammarella
f9f47b913d Add base64Binary type 2019-04-10 07:30:54 +02:00
Gianluigi 'cocciagialla' Mammarella
ca4991a9f6 Fix location url from relative to absolute 2019-04-10 07:30:25 +02:00
Gianluigi 'cocciagialla' Mammarella
cdf77dacd8 Fix input naming 2019-04-10 07:29:27 +02:00
Gianluigi 'cocciagialla' Mammarella
7802a0d19f Fix Dumper. Each complext type is now wrapped inside container element tag 2019-04-10 07:28:07 +02:00
Gianluigi 'cocciagialla' Mammarella
c4118855de Fix document literal binder for request and response 2019-04-10 07:22:34 +02:00
Gianluigi 'cocciagialla' Mammarella
2771991fc0 Set document instead of rpc as default binding style 2019-04-10 07:21:51 +02:00
Gianluigi 'cocciagialla' Mammarella
ceb69d97c3 Fix binding name and soapAction attribute on wsdl 2019-04-10 07:20:49 +02:00
Gianluigi 'cocciagialla' Mammarella
19326bccdd Add .idea to ignore 2019-04-10 07:20:07 +02:00
Gianluigi 'cocciagialla' Mammarella
22bde386ab Fix composer json 2019-04-02 15:15:56 +02:00
Gianluigi 'cocciagialla' Mammarella
2d36e5f060 Fix compatibility with SF4 + Other fixes 2019-04-02 14:58:41 +02:00
Gianluigi 'cocciagialla' Mammarella
873dc0ae08 Replace DefinitionDecorator with ChildDefinition 2019-03-14 04:53:26 +01:00
Gianluigi 'cocciagialla' Mammarella
0e24ffe23d Alias dev-master 2019-03-14 04:31:19 +01:00
Gianluigi Mammarella
d0f53bc806
pdate to SF4 2019-03-14 03:24:20 +01:00
Gianluigi Mammarella
0cb00e71b5
Change package name 2019-03-14 03:05:52 +01:00
Michael Veroux
cc888bf168 Deprecated method change 2019-02-13 10:02:20 +01:00
Michael Veroux
bb95a6cb45 Response xml format change support with backward compatibility 2019-02-11 12:28:54 +01:00
Michael Veroux
3f2a99adf6 Array support change
Support of mapping xml attributes
2019-02-11 12:28:54 +01:00
Michael Veroux
ad93b5ca49 PHP 7 compatibility 2019-02-11 11:55:54 +01:00
Michael Veroux
cdeab44c2c Like this, DATETIME_FORMAT could be overriden
Partial Fix BeSimple#68
2019-02-11 11:45:50 +01:00
Michael Veroux
e046be22eb Date semantics must support milliseconds for better interoperability
Fix BeSimple#68
2019-02-11 11:39:35 +01:00
Michael Veroux
b10b5431e5 Back to original name 2019-02-11 11:33:27 +01:00
Ghislain Loaec
408d88f164 Readme typo 2018-04-06 12:07:55 +02:00
Ghislain Loaec
0e4034a093 Merge tag '0.3.0' into develop
Compatibility Symfony 3
2018-04-06 12:02:37 +02:00
Ghislain Loaec
fd64676312 Merge branch 'release/0.3.0' 2018-04-06 12:02:15 +02:00
Ghislain Loaec
4d66d072ec Bump version 0.3.0 2018-04-06 12:01:48 +02:00
Ghislain Loaec
735f6a5826 README update 2018-04-06 11:58:10 +02:00
Ghislain Loaec
498012697d get path 2018-04-06 11:32:08 +02:00
Ghislain Loaec
b96b65cc49 ComtainerAware -> Interface 2018-04-06 11:29:08 +02:00
Ghislain Loaec
0748b23630 Symfony 2 fixes 2018-04-06 11:21:50 +02:00
Ghislain Loaec
63111261e7 Restart fomr 0.2 2018-04-06 11:18:36 +02:00
Ghislain Loaec
2b91f94b8d Ignore composer.phar 2018-04-06 11:06:18 +02:00
Ghislain Loaec
1af0828b15 Revert whole code to legacy 2018-04-06 10:58:45 +02:00
Ghislain Loaec
0ca2fe1fd5 getCurrentRequest 2018-04-06 10:53:16 +02:00
Ghislain Loaec
fd923e032e cache->getPath 2018-04-06 10:50:13 +02:00
Ghislain Loaec
e32514abe4 Add Classmap (common) 2018-04-06 10:43:58 +02:00
Ghislain Loaec
7322bfefd0 Add Classmap 2018-04-06 10:40:03 +02:00
Ghislain Loaec
e232b1d8b9 ContainerAware -> ContainerAwareInterface 2018-04-06 10:20:53 +02:00
Ghislain Loaec
1b87b4d212 Fix pattern->path 2018-04-06 10:16:21 +02:00
Ghislain Loaec
ae746087e6 Test With Legacy bundle 2018-04-06 10:12:08 +02:00
Ghislain Loaec
9312e4af6a Revert "Test"
This reverts commit c3da1d545aa930393216e4fc8fff9ca3ff1ead62.
2018-04-06 10:09:28 +02:00
Ghislain Loaec
c3da1d545a Test 2018-04-06 09:58:43 +02:00
Ghislain Loaec
ad2bd7bc7a Rename fork 2018-04-04 11:52:49 +02:00
Petr Bechyně
e58927469c Run mock server in each SoapClient test case & unit test fixed 2018-02-06 00:38:35 +01:00
Petr Bechyně
45cce3a41c Integration test fixed 2018-02-06 00:31:06 +01:00
Petr Bechyně
e6beef5a80
Merge pull request #14 from tmirks/enable-symfony-bundle
Get basic bundle configuration working for SoapClient with Symfony 3.x.
2018-02-05 23:53:11 +01:00
Tim Mirecki
69a7005c35 Get basic bundle configuration working for SoapClient with Symfony 3.x. 2018-01-18 11:40:02 -05:00
milanmimra
073028f160 Merge pull request #10 from vhorky/feature/curl-ssl-version
Soap client option allows setting CURLOPT_SSLVERSION
2017-09-21 10:54:15 +02:00
VH
a9f11beb83 Soap client option allows setting CURLOPT_SSLVERSION 2017-09-21 10:45:27 +02:00
Petr Bechyně
7ab8771989 Merge pull request #7 from tuscanicz/develop
Recognizing mime boundary according to RFC
2017-08-23 16:11:19 +02:00
milamimr
d68c25daad Recognizing mime boundary according to RFC 2017-08-23 15:30:36 +02:00
Petr Bechyně
6e117940a3 ResolveRemoteIncludes fix: RelativePathResolver was not used in XmlDomDocumentImportReplacer 2017-07-24 10:11:13 +02:00
Petr Bechyně
0c47f5a8d4 RelativePathResolver did not work correctly for ../directories 2017-07-21 14:49:42 +02:00
Petr Bechyně
75a0489cce Merge remote-tracking branch 'remotes/origin/develop' 2017-07-21 10:31:28 +02:00
Petr Bechyně
de5d6a2647 SoapClientOptions now contains resolve remove includes option for WSDL downloader 2017-07-21 10:21:50 +02:00
Petr Bechyně
6970b7bbef WsdlDownloader fix: remote includes now work correctly with relative URLs & tests added 2017-07-18 18:52:52 +02:00
Petr Bechyně
b650254d54 SoapClient::trace = SoapClientOptions::SOAP_CLIENT_TRACE_OFF fixed when SoapFault is thrown
Incompatible changes: 1) Default SoapClientOptionsBuilder method now sets tracing to ON and 2) SoapResponse now contains request in all calls so that SoapRequestFactory interface had to be changed.
2017-06-16 13:42:08 +02:00
Petr Bechyně
668f2dd258 PhpUnit - code coverage whitelisted 2017-06-13 13:06:58 +02:00
Petr Bechyně
a8bc834077 Mime/PartHeaders now handle both Content-ID and Content-id according to W3 specs 2017-06-12 15:14:28 +02:00
Petr Bechyně
f74e4b08ce Mime Parser: throws Exception with MimePartMessage contents 2017-06-12 00:28:27 +02:00
Petr Bechyně
dcd5ff5234 Travis now run only PHP 7.x builds, phpstan requirements will fail on 5.6.x or previous 2017-06-07 17:10:10 +02:00
Petr Bechyně
7bd8481a4e Travis CI - test fixes
1. Travis has to run PHP build-in server separately, 2. SoapFault message expectations are now Couldn't/Could not
2017-06-07 17:05:03 +02:00
Petr Bechyně
c82288d641 Travis deployment fixed 2017-06-07 16:23:47 +02:00
Petr Bechyně
bb20882ade Readme updated 2017-06-07 16:18:46 +02:00
Petr Bechyně
2264e329a1 Added phing for running tests & fixed issues in order to pass the tests 2017-06-07 15:50:04 +02:00
Petr Bechyně
b9e36b4900 Fix notice: attribute soapClientOptions defined in Trait and Client class 2017-06-05 10:50:53 +02:00
Petr Bechyně
d495f22413 SoapFaultWithTracingData now provides request / response information from Server SoapFaults 2017-05-30 18:29:51 +02:00
Petr Bechyně
8db9b374e4 SoapFault handling refactored: client now returns server fault codes + more details in message 2017-05-26 10:53:41 +02:00
Petr Bechyně
f669c18c7f Merge pull request #3 from ceesco53/patch-1
composer.json refers to upstream not this fork (README.md fix)
2017-05-25 19:07:26 +02:00
John
524d1f3fd7 composer.json refers to upstream not this fork
Using the composer.json instructions as is will cause the rest of your instructions to fail.  It points to upstream package.  I've got some other changes coming soon.  Happy to help.
2017-05-25 12:13:58 -04:00
Petr Bechyně
ecffdc18fd Minor bugfixes of SoapFault handling
SoapFault is now properly prefixed so that SoapFaultSourceGetter identifies them correctly, missing exceptions option is now processed in SoapServer
2017-05-10 09:15:27 +02:00
Petr Bechyně
b45202f40a Project composer description update 2017-04-26 13:00:40 +02:00
273 changed files with 6921 additions and 7763 deletions

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
/vendor/
composer.lock
composer.phar
phpunit.xml
.idea/
.idea
.php_cs.cache

View File

@ -1,16 +1,16 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
env:
- SYMFONY_VERSION=2.6.*
- SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION="dev-master symfony/debug:~2.8@dev symfony/http-kernel:~2.8@dev"
before_script:
- phpenv config-add myphp.ini
- composer self-update
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
- composer update --no-interaction --prefer-source
@ -22,4 +22,4 @@ script:
matrix:
allow_failures:
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.8@dev symfony/http-kernel:~2.8@dev"

View File

@ -1,9 +1,30 @@
# BeSimpleSoap
# BeSimpleSoap (Symfony 3.4 / 4.x)
Build SOAP and WSDL based web services.
This fork is a refactored version that fixes a lot of errors and provides
better API, robust, stable and modern codebase.
See [How to use](#how-to-use) that will help you to understand the magic.
This fork provides the BeSimpleSoap bundle, updated to be compatible with Symfony 3.4 and 4.x (as well as with PHP 7.0-7.4).
We forked the official [BeSimpleSoap](https://github.com/BeSimple/BeSimpleSoap) repository in order to sucessfully maintain some of our projects.
We now have integrated changes and fixes from sub-forks (thank you guys!), and we should be up to date now :)
This fork is maintained by people from [Cadoles](https://www.cadoles.com/).
# Contributing
We do welcome pull requests :) please include tests if you can.
Running tests can be done by running `php vendor/bin/phpunit`.
# Installation
If you do not yet have composer, follow instructions on the [Composer website](https://getcomposer.org/download/) to install it.
Then just running:
```
$ composer require cadoles/soap
```
should be enough to get you up and running.
# Components
@ -34,35 +55,11 @@ The BeSimpleSoapBundle is a Symfony2 bundle to build WSDL and SOAP based web ser
For further information see the the original [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapBundle/README.md).
*Will not work since the Symfony libraries were removed and usages of other components were not refactored. Feel free to fork this repository and fix it!*
# Installation
If you do not yet have composer, install it like this:
```sh
curl -s http://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin
```
Create a `composer.json` file:
```json
{
"require": {
"besimple/soap": "0.2.*@dev"
}
}
```
Now you are ready to install the library:
```sh
php /usr/local/bin/composer.phar install
```
# How to use
You can investigate the unit tests dir ``tests`` in order to get a clue.
Forget about associative arrays, vague configurations, multiple extension and silent errors!
This may look a bit more complex at the first sight,
Forget about associative arrays, vague configurations, multiple extension and silent errors!
This may look a bit more complex at the first sight,
but it will guide you to configure and set up your client or server properly.
## Example of soap client call
@ -81,7 +78,8 @@ var_dump($soapResponse); // Contains Response, Attachments
```
### Something wrong?!
Turn on the tracking and catch `SoapFaultWithTracingData` exception to get some sweets :)
Turn on the tracking and catch `SoapFaultWithTracingData` exception to get some sweets :)
```php
try {
@ -96,7 +94,7 @@ Using a ClassMap, you help SoapClient to turn it into XML request.
## Example of soap server handling
Starting a SOAP server is a bit more complex.
I recommend you to inspect SoapServer unit tests for inspiration.
I recommend you to inspect SoapServer unit tests for inspiration.
```php
$dummyService = new DummyService();
@ -119,6 +117,7 @@ $response = $soapServer->handleRequest($request);
var_dump($response); // Contains Response, Attachments
```
In this example, a ``DummyService`` service has been used to handle request.
Using a service can help you create coherent SoapServer endpoints.
Service can hold an endpoint URL, WSDL path and a class map as associative array.
@ -130,18 +129,18 @@ The method will receive request object and return response object that are match
See a simplified implementation of ``dummyServiceMethod`` to get a clue:
```
/**
* @param DummyServiceRequest $dummyServiceRequest
* @return DummyServiceResponse
*/
public function dummyServiceMethod(DummyServiceRequest $dummyServiceRequest)
{
$response = new DummyServiceResponse();
$response->status = true;
```php
/**
* @param DummyServiceRequest $dummyServiceRequest
* @return DummyServiceResponse
*/
public function dummyServiceMethod(DummyServiceRequest $dummyServiceRequest)
{
$response = new DummyServiceResponse();
$response->status = true;
return $response;
}
return $response;
}
```
For further information and getting inspiration for your implementation, see the unit tests in ``tests`` dir.
For further information and getting inspiration for your implementation, see the unit tests in ``tests`` dir.

2
cache/.gitignore vendored
View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,8 +1,9 @@
{
"name": "tuscanicz/soap",
"name": "cadoles/soap",
"type": "library",
"description": "A fork of the abandoned besimple/soap package with added support for Symfony 3.0",
"keywords": ["soap", "soap server", "soap client"],
"description": "Build and consume SOAP and WSDL based web services",
"keywords": ["soap"],
"homepage": "https://github.com/Cadoles/BeSimpleSoap",
"license": "MIT",
"authors": [
{
@ -16,42 +17,37 @@
{
"name": "Andreas Schamberger",
"email": "mail@andreass.net"
},
{
"name": "Petr Bechyně",
"email": "mail@petrbechyne.com"
}
],
"require": {
"php": ">=5.3.0|>=7.0",
"php": ">=7.0",
"ext-soap": "*",
"ext-curl": "*",
"ass/xmlsecurity": "~1.0",
"zendframework/zend-mime": "2.1.*"
"symfony/framework-bundle": "~3.4|~4.0",
"symfony/twig-bundle": "~3.4|~4.0",
"laminas/laminas-mime": "~2.1"
},
"replace": {
"besimple/soap-bundle": "self.version",
"besimple/soap-client": "self.version",
"besimple/soap-common": "self.version",
"besimple/soap-server": "self.version",
"besimple/soap-wsdl": "self.version"
"besimple/soap-wsdl": "self.version",
"cocciagialla/soap": "self.version"
},
"require-dev": {
"ext-mcrypt": "*",
"mikey179/vfsStream": "~1.0",
"phpunit/phpunit": "~4.0"
"mikey179/vfsstream": "~1.6.5",
"symfony/filesystem": "~2.3",
"symfony/process": "~2.3",
"phpunit/phpunit": "^5.7"
},
"autoload": {
"psr-0": { "BeSimple\\": "src/" }
},
"autoload-dev": {
"psr-4": {
"": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "0.4-dev"
"dev-master": "5.2.0-dev"
}
}
}

1349
composer.lock generated
View File

@ -1,1349 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "7601f1ec280c086361e1deaf021f8ca1",
"content-hash": "59372f34124af17d5c35938dfffc6075",
"packages": [
{
"name": "ass/xmlsecurity",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/aschamberger/XmlSecurity.git",
"reference": "c8976519ebbf6e4d953cd781d09df44b7f65fbb8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aschamberger/XmlSecurity/zipball/c8976519ebbf6e4d953cd781d09df44b7f65fbb8",
"reference": "c8976519ebbf6e4d953cd781d09df44b7f65fbb8",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"lib-openssl": ">=0.9.0",
"php": ">=5.3.0"
},
"require-dev": {
"satooshi/php-coveralls": "dev-master"
},
"suggest": {
"ext-mcrypt": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"ass\\XmlSecurity": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Robert Richards",
"email": "rrichards@cdatazone.org"
},
{
"name": "Andreas Schamberger",
"email": "mail@andreass.net"
}
],
"description": "The XmlSecurity library is written in PHP for working with XML Encryption and Signatures",
"homepage": "https://github.com/aschamberger/XmlSecurity",
"keywords": [
"encryption",
"security",
"signature",
"xml"
],
"time": "2015-05-31 10:10:35"
},
{
"name": "zendframework/zend-mime",
"version": "2.1.6",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-mime.git",
"reference": "066d6eecff586a7fb10e8907c032beaf1a9d6104"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-mime/zipball/066d6eecff586a7fb10e8907c032beaf1a9d6104",
"reference": "066d6eecff586a7fb10e8907c032beaf1a9d6104",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"zendframework/zend-stdlib": "self.version"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-mail": "self.version"
},
"suggest": {
"zendframework/zend-mail": "Zend\\Mail component"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev",
"dev-develop": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Mime\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-mime",
"keywords": [
"mime",
"zf2"
],
"time": "2013-04-17 13:32:54"
},
{
"name": "zendframework/zend-stdlib",
"version": "2.1.6",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "0027339961ad3d49f91ee092e23f7269c18cb470"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/0027339961ad3d49f91ee092e23f7269c18cb470",
"reference": "0027339961ad3d49f91ee092e23f7269c18cb470",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-filter": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-servicemanager": "self.version"
},
"suggest": {
"pecl-weakref": "Implementation of weak references for Stdlib\\CallbackHandler",
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
"zendframework/zend-filter": "To support naming strategy hydrator usage",
"zendframework/zend-serializer": "Zend\\Serializer component",
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev",
"dev-develop": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-stdlib",
"keywords": [
"stdlib",
"zf2"
],
"time": "2013-04-17 13:32:54"
}
],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14 21:17:01"
},
{
"name": "mikey179/vfsStream",
"version": "v1.6.4",
"source": {
"type": "git",
"url": "https://github.com/mikey179/vfsStream.git",
"reference": "0247f57b2245e8ad2e689d7cee754b45fbabd592"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikey179/vfsStream/zipball/0247f57b2245e8ad2e689d7cee754b45fbabd592",
"reference": "0247f57b2245e8ad2e689d7cee754b45fbabd592",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
},
"autoload": {
"psr-0": {
"org\\bovigo\\vfs\\": "src/main/php"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Frank Kleine",
"homepage": "http://frankkleine.de/",
"role": "Developer"
}
],
"description": "Virtual file system to mock the real file system in unit tests.",
"homepage": "http://vfs.bovigo.org/",
"time": "2016-07-18 14:02:57"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2015-12-27 11:43:31"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.2.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2016-09-30 07:12:33"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2016-11-25 06:54:22"
},
{
"name": "phpspec/prophecy",
"version": "v1.6.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"sebastian/comparator": "^1.1",
"sebastian/recursion-context": "^1.0|^2.0"
},
"require-dev": {
"phpspec/phpspec": "^2.0",
"phpunit/phpunit": "^4.8 || ^5.6.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2016-11-21 14:58:47"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2015-10-06 15:47:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2016-10-03 07:40:28"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21 13:50:34"
},
{
"name": "phpunit/php-timer",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4|~5"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2016-05-12 18:03:57"
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b",
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2016-11-15 14:06:22"
},
{
"name": "phpunit/phpunit",
"version": "4.8.34",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "7eb45205d27edd94bd2b3614085ea158bd1e2bca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7eb45205d27edd94bd2b3614085ea158bd1e2bca",
"reference": "7eb45205d27edd94bd2b3614085ea158bd1e2bca",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpspec/prophecy": "^1.3.1",
"phpunit/php-code-coverage": "~2.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.2.2",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.3",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.8.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2017-01-26 16:15:36"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2",
"sebastian/exporter": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2015-10-02 06:51:40"
},
{
"name": "sebastian/comparator",
"version": "1.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2 || ~2.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-01-29 09:50:25"
},
{
"name": "sebastian/diff",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2015-12-08 07:14:41"
},
{
"name": "sebastian/environment",
"version": "1.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2016-08-18 05:49:44"
},
{
"name": "sebastian/exporter",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2016-06-17 09:04:28"
},
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12 03:26:01"
},
{
"name": "sebastian/recursion-context",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-11-11 19:50:13"
},
{
"name": "sebastian/version",
"version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21 13:59:46"
},
{
"name": "symfony/yaml",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "50eadbd7926e31842893c957eca362b21592a97d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/50eadbd7926e31842893c957eca362b21592a97d",
"reference": "50eadbd7926e31842893c957eca362b21592a97d",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"symfony/console": "~2.8|~3.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-01-03 13:51:32"
},
{
"name": "webmozart/assert",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2016-11-23 20:04:58"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.0|>=7.0",
"ext-soap": "*",
"ext-curl": "*"
},
"platform-dev": {
"ext-mcrypt": "*"
}
}

View File

@ -9,15 +9,26 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
stderr="true"
bootstrap="vendor/autoload.php">
bootstrap="vendor/autoload.php"
>
<php>
<const name="WEBSERVER_PORT" value="8000" />
</php>
<testsuites>
<testsuite name="BeSimpleSoapTestSuite">
<directory>tests</directory>
<testsuite name="BeSimpleSoap Test Suite">
<directory>./src/BeSimple/*/Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/BeSimple/</directory>
<exclude>
<directory>./src/BeSimple/*/Tests</directory>
<directory>./src/BeSimple/*/Resources</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

View File

@ -1,3 +1,4 @@
vendor/
composer.lock
phpunit.xml
.idea/

View File

@ -13,45 +13,27 @@
namespace BeSimple\SoapBundle;
use BeSimple\SoapCommon\Cache as BaseCache;
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use Exception;
/**
* @author Francis Besset <francis.besset@gmail.com>
*/
class Cache
{
public function __construct(SoapOptions $soapOptions)
public function __construct($cacheDisabled, $type, $directory, $lifetime = null, $limit = null)
{
if ($soapOptions->isWsdlCached()) {
$isEnabled = (bool)$soapOptions->isWsdlCached() ? BaseCache::ENABLED : BaseCache::DISABLED;
$isEnabled = (Boolean) $cacheDisabled ? BaseCache::DISABLED : BaseCache::ENABLED;
BaseCache::setEnabled($isEnabled);
BaseCache::setType($soapOptions->getWsdlCacheType());
BaseCache::setDirectory($soapOptions->getWsdlCacheDir());
} else {
BaseCache::setEnabled(BaseCache::DISABLED);
BaseCache::setType(SoapOptions::SOAP_CACHE_TYPE_NONE);
BaseCache::setDirectory(null);
BaseCache::setEnabled($isEnabled);
BaseCache::setType($type);
BaseCache::setDirectory($directory);
if (null !== $lifetime) {
BaseCache::setLifetime($lifetime);
}
}
public function validateSettings(SoapOptions $soapOptions)
{
if ($soapOptions->isWsdlCached()) {
if (BaseCache::isEnabled() !== true) {
throw new Exception('WSDL cache could not be set');
}
if ($soapOptions->getWsdlCacheType() !== (int)BaseCache::getType()) {
throw new Exception('WSDL cache type could not be set, ini settings is: '.BaseCache::getType());
}
if ($soapOptions->getWsdlCacheDir() !== BaseCache::getDirectory()) {
throw new Exception('WSDL cache dir could not be set, real dir is: '.BaseCache::getDirectory());
}
} else {
if (BaseCache::isEnabled() !== false) {
throw new Exception('WSDL cache could not be turned off');
}
if (null !== $limit) {
BaseCache::setLimit($limit);
}
}
}

View File

@ -15,15 +15,17 @@ namespace BeSimple\SoapBundle\Controller;
use BeSimple\SoapBundle\Handler\ExceptionHandler;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapBundle\WebServiceContext;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* @author Christian Kerl <christian-kerl@web.de>
@ -56,19 +58,20 @@ class SoapWebServiceController implements ContainerAwareInterface
/**
* @var array
*/
private $headers = array();
private $headers = [];
/**
* @return \BeSimple\SoapBundle\Soap\SoapResponse
*/
public function callAction($webservice)
{
$webServiceContext = $this->getWebServiceContext($webservice);
/** @var WebServiceContext $webServiceContext */
$webServiceContext = $this->getWebServiceContext($webservice);
$this->serviceBinder = $webServiceContext->getServiceBinder();
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request_stack')->getCurrentRequest());
$this->soapServer = $webServiceContext
$this->soapServer = $webServiceContext
->getServerBuilder()
->withSoapVersion11()
->withHandler($this)
@ -86,19 +89,26 @@ class SoapWebServiceController implements ContainerAwareInterface
}
/**
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function definitionAction($webservice)
{
$routeName = $webservice.'_webservice_call';
$result = $this->container->get('router')->getRouteCollection()->get($routeName);
if (null === $result) {
$routeName = '_webservice_call';
}
$response = new Response($this->getWebServiceContext($webservice)->getWsdlFileContent(
$this->container->get('router')->generate(
'_webservice_call',
array('webservice' => $webservice),
true
$routeName,
['webservice' => $webservice],
UrlGeneratorInterface::ABSOLUTE_URL
)
));
$request = $this->container->get('request');
/** @var Request $request */
$request = $this->container->get('request_stack')->getCurrentRequest();
$query = $request->query;
if ($query->has('wsdl') || $query->has('WSDL')) {
$request->setRequestFormat('wsdl');
@ -124,14 +134,14 @@ class SoapWebServiceController implements ContainerAwareInterface
throw new \LogicException(sprintf('The parameter "%s" is required in Request::$query parameter bag to generate the SoapFault.', '_besimple_soap_webservice'), null, $e);
}
$view = 'TwigBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
$view = '@Twig/Exception/'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
$code = $exception->getStatusCode();
$details = $this->container->get('templating')->render($view, array(
$details = $this->container->get('twig')->render($view, [
'status_code' => $code,
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
'exception' => $exception,
'logger' => $logger,
));
'exception' => $exception,
'logger' => $logger,
]);
$handler = new ExceptionHandler($exception, $details);
if ($soapFault = $request->query->get('_besimple_soap_fault')) {
@ -141,8 +151,8 @@ class SoapWebServiceController implements ContainerAwareInterface
$request->query->remove('_besimple_soap_fault');
}
$server = SoapServerBuilder::createWithDefaults(__DIR__.'/../Handler/wsdl/exception.wsdl')
->withWsdl()
$server = SoapServerBuilder::createWithDefaults()
->withWsdl(__DIR__.'/../Handler/wsdl/exception.wsdl')
->withWsdlCacheNone()
->withHandler($handler)
->build()
@ -165,8 +175,8 @@ class SoapWebServiceController implements ContainerAwareInterface
* This method gets called once for every SOAP header the \SoapServer received
* and afterwards once for the called SOAP operation.
*
* @param string $method The SOAP header or SOAP operation name
* @param array $arguments
* @param string $method The SOAP header or SOAP operation name
* @param array $arguments
*
* @return mixed
*/
@ -223,7 +233,7 @@ class SoapWebServiceController implements ContainerAwareInterface
}
/**
* Set the SoapResponse
* Set the SoapResponse.
*
* @param Response $response A response to check and set
*
@ -240,7 +250,7 @@ class SoapWebServiceController implements ContainerAwareInterface
return $this->soapResponse = $response;
}
private function getWebServiceContext($webservice)
protected function getWebServiceContext($webservice)
{
$context = sprintf('besimple.soap.context.%s', $webservice);

View File

@ -48,7 +48,7 @@ class TypeRepository
public function fixTypeInformation(ServiceDefinition $definition)
{
foreach($definition->getAllTypes() as $type) {
foreach ($definition->getAllTypes() as $type) {
$phpType = $type->getPhpType();
$xmlType = $type->getXmlType();

View File

@ -12,7 +12,7 @@ namespace BeSimple\SoapBundle\Converter;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapBundle\Util\String;
use BeSimple\SoapBundle\Util\BsString;
use BeSimple\SoapCommon\Converter\TypeConverterInterface;
/**
@ -40,7 +40,7 @@ class XopIncludeTypeConverter implements TypeConverterInterface
$ref = $include->getAttribute('href');
if (String::startsWith($ref, 'cid:')) {
if (BsString::startsWith($ref, 'cid:')) {
$cid = urldecode(substr($ref, 4));
return $request->getSoapAttachments()->get($cid)->getContent();

View File

@ -17,10 +17,11 @@ use BeSimple\SoapCommon\Cache;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;
/**
* BeSimpleSoapExtension.
@ -59,7 +60,7 @@ class BeSimpleSoapExtension extends Extension
$container->setParameter('besimple.soap.definition.dumper.options.stylesheet', $config['wsdl_dumper']['stylesheet']);
foreach($config['services'] as $name => $serviceConfig) {
foreach ($config['services'] as $name => $serviceConfig) {
$serviceConfig['name'] = $name;
$this->createWebServiceContext($serviceConfig, $container);
}
@ -80,17 +81,21 @@ class BeSimpleSoapExtension extends Extension
private function registerClientConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
$loader->load('client.xml');
if (3 === Kernel::MAJOR_VERSION) {
$loader->load('client3.xml');
} else {
$loader->load('client.xml');
}
foreach ($config as $client => $options) {
$definition = new DefinitionDecorator('besimple.soap.client.builder');
$definition = new ChildDefinition('besimple.soap.client.builder');
$container->setDefinition(sprintf('besimple.soap.client.builder.%s', $client), $definition);
$definition->replaceArgument(0, $options['wsdl']);
$defOptions = $container
->getDefinition('besimple.soap.client.builder')
->getArgument(1);
->getDefinition('besimple.soap.client.builder')
->getArgument(1);
foreach (array('cache_type', 'user_agent') as $key) {
if (isset($options[$key])) {
@ -130,7 +135,7 @@ class BeSimpleSoapExtension extends Extension
private function createClientClassmap($client, array $classmap, ContainerBuilder $container)
{
$definition = new DefinitionDecorator('besimple.soap.classmap');
$definition = new ChildDefinition('besimple.soap.classmap');
$container->setDefinition(sprintf('besimple.soap.classmap.%s', $client), $definition);
if (!empty($classmap)) {
@ -144,13 +149,18 @@ class BeSimpleSoapExtension extends Extension
private function createClient($client, ContainerBuilder $container)
{
$definition = new DefinitionDecorator('besimple.soap.client');
$definition = new ChildDefinition('besimple.soap.client');
$container->setDefinition(sprintf('besimple.soap.client.%s', $client), $definition);
$definition->setFactory(array(
new Reference(sprintf('besimple.soap.client.builder.%s', $client)),
'build'
));
if (Kernel::MAJOR_VERSION >= 3) {
$definition->setFactory(array(
new Reference(sprintf('besimple.soap.client.builder.%s', $client)),
'build'
));
$definition->setPublic(true);
} else {
$definition->setFactoryService(sprintf('besimple.soap.client.builder.%s', $client));
}
}
private function createWebServiceContext(array $config, ContainerBuilder $container)
@ -159,7 +169,7 @@ class BeSimpleSoapExtension extends Extension
unset($config['binding']);
$contextId = 'besimple.soap.context.'.$config['name'];
$definition = new DefinitionDecorator('besimple.soap.context.'.$bindingSuffix);
$definition = new ChildDefinition('besimple.soap.context.'.$bindingSuffix);
$container->setDefinition($contextId, $definition);
if (isset($config['cache_type'])) {
@ -168,6 +178,7 @@ class BeSimpleSoapExtension extends Extension
$options = $container
->getDefinition('besimple.soap.context.'.$bindingSuffix)
->setPublic(true)
->getArgument(2);
$definition->replaceArgument(2, array_merge($options, $config));

View File

@ -96,8 +96,12 @@ class Configuration
->info('proxy configuration')
->addDefaultsIfNotSet()
->beforeNormalization()
->ifTrue(function ($v) { return !is_array($v); })
->then(function ($v) { return array('host' => null === $v ? false : $v); })
->ifTrue(function ($v) {
return !is_array($v);
})
->then(function ($v) {
return array('host' => null === $v ? false : $v);
})
->end()
->children()
->scalarNode('host')->defaultFalse()->end()

View File

@ -20,7 +20,7 @@
</service>
<service id="besimple.soap.client" class="%besimple.soap.client.builder.class%" abstract="true">
<factory class="besimple.soap.client.builder" method="build" />
<factory service="besimple.soap.client.builder" method="build" />
</service>
<service id="besimple.soap.classmap" class="%besimple.soap.classmap.class%" abstract="true" />

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="besimple.soap.client.builder.class">BeSimple\SoapBundle\Soap\SoapClientBuilder</parameter>
<parameter key="besimple.soap.classmap.class">BeSimple\SoapCommon\Classmap</parameter>
</parameters>
<services>
<service id="besimple.soap.client.builder" class="%besimple.soap.client.builder.class%" abstract="true">
<argument /> <!-- wsdl URI -->
<argument type="collection">
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="besimple.soap.classmap" />
<argument type="service" id="besimple.soap.converter.collection" />
<argument type="service" id="besimple.soap.cache" /> <!-- hack to load besimple cache configuration -->
</service>
<service id="besimple.soap.client" class="%besimple.soap.client.builder.class%" abstract="true">
<factory service="besimple.soap.client.builder" method="build" />
</service>
<service id="besimple.soap.classmap" class="%besimple.soap.classmap.class%" abstract="true" />
</services>
</container>

View File

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="_webservice_call" path="/{webservice}">
<route id="_webservice_call" path="/{webservice}" methods="POST">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Call</default>
<default key="_format">xml</default>
<requirement key="_method">POST</requirement>
</route>
<route id="_webservice_definition" path="/{webservice}">
<route id="_webservice_definition" path="/{webservice}" methods="GET">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Definition</default>
<default key="_format">xml</default>
<requirement key="_method">GET</requirement>
</route>
</routes>

View File

@ -19,7 +19,7 @@
</parameters>
<services>
<service id="besimple.soap.response" class="%besimple.soap.response.class%" />
<service id="besimple.soap.response" class="%besimple.soap.response.class%" public="true" />
<service id="besimple.soap.response.listener" class="%besimple.soap.response.listener.class%">
<tag name="kernel.event_listener" event="kernel.view" method="onKernelView" />
@ -96,6 +96,14 @@
<argument>dateTime</argument>
<argument>xsd:dateTime</argument>
</call>
<call method="addType">
<argument>base64Binary</argument>
<argument>xsd:base64Binary</argument>
</call>
<call method="addType">
<argument>hexBinary</argument>
<argument>xsd:hexBinary</argument>
</call>
</service>
</services>

View File

@ -0,0 +1,33 @@
<?php
/*
* This file is part of the BeSimpleSoapBundle.
*
* (c) Christian Kerl <christian-kerl@web.de>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
/**
* @author Francis Besset <francis.besset@gmail.com>
*/
class DocumentLiteralWrappedRequestHeaderMessageBinder extends DocumentLiteralWrappedRequestMessageBinder
{
private $header;
public function setHeader($header)
{
$this->header = $header;
}
public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
{
$headerDefinition = $messageDefinition->getHeaders()->get($this->header);
return [];
}
}

View File

@ -11,25 +11,26 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
/**
* @author Christian Kerl <christian-kerl@web.de>
*/
class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterface
{
public function processMessage(Method $messageDefinition, $message)
public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
{
if(count($message) > 1) {
if (count($message) > 1) {
throw new \InvalidArgumentException();
}
$result = array();
$result = array();
$message = $message[0];
foreach($messageDefinition->getArguments() as $argument) {
$result[$argument->getName()] = $message->{$argument->getName()};
foreach ($messageDefinition->getInput()->all() as $argument) {
$result[$argument->getName()] = $message;
}
return $result;
}
}
}

View File

@ -11,17 +11,15 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
/**
* @author Christian Kerl <christian-kerl@web.de>
*/
class DocumentLiteralWrappedResponseMessageBinder implements MessageBinderInterface
{
public function processMessage(Method $messageDefinition, $message)
public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
{
$result = new \stdClass();
$result->{$messageDefinition->getName().'Result'} = $message;
return $result;
return $message;
}
}
}

View File

@ -24,5 +24,5 @@ interface MessageBinderInterface
*
* @return mixed
*/
function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository);
public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository);
}

View File

@ -32,7 +32,10 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
{
$this->typeRepository = $typeRepository;
return $this->processType($messageDefinition->getOutput()->get('return')->getType(), $message);
$parts = $messageDefinition->getOutput()->all();
$part = array_shift($parts);
return $this->processType($part->getType(), $message);
}
private function processType($phpType, $message)

View File

@ -44,7 +44,8 @@ class ServiceBinder
* @param MessageBinderInterface $requestMessageBinder
* @param MessageBinderInterface $responseMessageBinder
*/
public function __construct(Definition $definition, MessageBinderInterface $requestHeaderMessageBinder, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder) {
public function __construct(Definition $definition, MessageBinderInterface $requestHeaderMessageBinder, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder)
{
$this->definition = $definition;
$this->requestHeaderMessageBinder = $requestHeaderMessageBinder;

View File

@ -18,6 +18,7 @@ class ComplexType extends Configuration
private $name;
private $value;
private $isNillable = false;
private $minOccurs = 1;
public function getName()
{
@ -34,6 +35,11 @@ class ComplexType extends Configuration
return $this->isNillable;
}
public function getIsNillable()
{
return $this->isNillable;
}
public function setName($name)
{
$this->name = $name;
@ -49,8 +55,23 @@ class ComplexType extends Configuration
$this->isNillable = (bool) $isNillable;
}
public function setIsNillable($isNillable)
{
$this->isNillable = (bool) $isNillable;
}
public function setMinOccurs($minOccurs)
{
$this->minOccurs = $minOccurs;
}
public function getMinOccurs()
{
return $this->minOccurs;
}
public function getAliasName()
{
return 'complextype';
}
}
}

View File

@ -22,5 +22,5 @@ interface ConfigurationInterface
*
* @return string
*/
function getAliasName();
}
public function getAliasName();
}

View File

@ -19,4 +19,4 @@ class Header extends Param
{
return 'header';
}
}
}

View File

@ -42,4 +42,4 @@ class Method extends Configuration
{
return 'method';
}
}
}

View File

@ -53,4 +53,4 @@ class Param extends Configuration implements TypedElementInterface
{
return 'param';
}
}
}

View File

@ -42,4 +42,4 @@ class Result extends Configuration implements TypedElementInterface
{
return 'result';
}
}
}

View File

@ -12,8 +12,8 @@ namespace BeSimple\SoapBundle\ServiceDefinition\Annotation;
interface TypedElementInterface
{
function getPhpType();
function getXmlType();
function setPhpType($phpType);
function setXmlType($xmlType);
}
public function getPhpType();
public function getXmlType();
public function setPhpType($phpType);
public function setXmlType($xmlType);
}

View File

@ -20,6 +20,7 @@ class ComplexType
private $name;
private $value;
private $isNillable = false;
private $minOccurs = 1;
public function getName()
{
@ -50,4 +51,14 @@ class ComplexType
{
$this->isNillable = (bool) $isNillable;
}
public function setMinOccurs($minOccurs)
{
$this->minOccurs = $minOccurs;
}
public function getMinOccurs()
{
return $this->minOccurs;
}
}

View File

@ -96,6 +96,7 @@ class AnnotationClassLoader extends Loader
}
$serviceReturn = $annotation->getPhpType();
$serviceXmlReturn = $annotation->getXmlType();
}
}
@ -116,7 +117,11 @@ class AnnotationClassLoader extends Loader
throw new \LogicException(sprintf('@Soap\Result non-existent for "%s".', $method->getName()));
}
$serviceMethod->setOutput($this->loadType($serviceReturn));
if (!isset($serviceXmlReturn) || !$serviceXmlReturn) {
$serviceXmlReturn = 'return';
}
$serviceMethod->setOutput($this->loadType($serviceReturn), $serviceXmlReturn);
$definition->addMethod($serviceMethod);
}
@ -133,7 +138,7 @@ class AnnotationClassLoader extends Loader
*/
private function getController(\ReflectionClass $class, \ReflectionMethod $method, Annotation\Method $annotation)
{
if(null !== $annotation->getService()) {
if (null !== $annotation->getService()) {
return $annotation->getService() . ':' . $method->name;
} else {
return $class->name . '::' . $method->name;
@ -155,7 +160,7 @@ class AnnotationClassLoader extends Loader
$loaded = $complexTypeResolver->load($phpType);
$complexType = new ComplexType($phpType, isset($loaded['alias']) ? $loaded['alias'] : $phpType);
foreach ($loaded['properties'] as $name => $property) {
$complexType->add($name, $this->loadType($property->getValue()), $property->isNillable());
$complexType->add($name, $this->loadType($property->getValue()), $property->isNillable(), $property->getMinOccurs());
}
$this->typeRepository->addComplexType($complexType);

View File

@ -24,7 +24,7 @@ use BeSimple\SoapBundle\Util\Collection;
*/
class AnnotationComplexTypeLoader extends AnnotationClassLoader
{
private $aliasClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\Alias';
private $aliasClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\Alias';
private $complexTypeClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\ComplexType';
/**
@ -43,7 +43,7 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
}
$annotations = array();
$annotations = [];
$class = new \ReflectionClass($class);
if ($alias = $this->reader->getClassAnnotation($class, $this->aliasClass)) {
@ -59,6 +59,7 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
$propertyComplexType->setValue($complexType->getValue());
$propertyComplexType->setNillable($complexType->isNillable());
$propertyComplexType->setName($property->getName());
$propertyComplexType->setMinOccurs($complexType->getMinOccurs());
$annotations['properties']->add($propertyComplexType);
}
}
@ -72,7 +73,7 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
* @param mixed $resource A resource
* @param string $type The resource type
*
* @return Boolean True if this class supports the given resource, false otherwise
* @return bool True if this class supports the given resource, false otherwise
*/
public function supports($resource, $type = null)
{

View File

@ -1,36 +0,0 @@
<?php
namespace BeSimple\SoapBundle\Soap;
class SoapAttachmentList
{
private $soapAttachments;
/**
* @param SoapAttachment[] $soapAttachments
*/
public function __construct(array $soapAttachments = [])
{
$this->soapAttachments = $soapAttachments;
}
public function hasSoapAttachments()
{
return $this->soapAttachments !== null && count($this->soapAttachments) > 0;
}
public function getSoapAttachments()
{
return $this->soapAttachments;
}
public function getSoapAttachmentIds()
{
$ids = [];
foreach ($this->getSoapAttachments() as $soapAttachment) {
$ids[] = $soapAttachment->getId();
}
return $ids;
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace BeSimple\SoapBundle\Soap;
use BeSimple\SoapCommon\Classmap;
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
use BeSimple\SoapClient\SoapClientBuilder as BaseSoapClientBuilder;
class SoapClientBuilder extends BaseSoapClientBuilder
{
protected $soapClient;
public function __construct($wsdl, array $options, Classmap $classmap = null, TypeConverterCollection $converters = null)
{
parent::__construct();
$this->checkOptions($options);
$this
->withWsdl($wsdl)
->withTrace($options['debug'])
;
if (isset($options['user_agent'])) {
$this->withUserAgent($options['user_agent']);
}
if (isset($options['cache_type'])) {
$this->withWsdlCache($options['cache_type']);
}
if ($classmap) {
$this->withClassmap($classmap);
}
if ($converters) {
$this->withTypeConverters($converters);
}
}
public function build()
{
if (!$this->soapClient) {
$this->soapClient = parent::build();
}
return $this->soapClient;
}
protected function checkOptions(array $options)
{
$checkOptions = array(
'debug' => false,
'cache_type' => null,
'exceptions' => true,
'user_agent' => 'BeSimpleSoap',
);
// check option names and live merge, if errors are encountered Exception will be thrown
$invalid = array();
$isInvalid = false;
foreach ($options as $key => $value) {
if (!array_key_exists($key, $checkOptions)) {
$isInvalid = true;
$invalid[] = $key;
}
}
if ($isInvalid) {
throw new \InvalidArgumentException(sprintf(
'The "%s" class does not support the following options: "%s".',
get_class($this),
implode('\', \'', $invalid)
));
}
}
}

View File

@ -12,7 +12,7 @@ namespace BeSimple\SoapBundle\Soap;
use BeSimple\SoapBundle\Util\Collection;
use Symfony\Component\HttpFoundation\Request;
use Zend\Mime\Message;
use Laminas\Mime\Message;
/**
* SoapRequest.
@ -69,7 +69,7 @@ class SoapRequest extends Request
*/
public function getSoapMessage()
{
if(null === $this->soapMessage) {
if (null === $this->soapMessage) {
$this->soapMessage = $this->initializeSoapMessage();
}
@ -88,12 +88,12 @@ class SoapRequest extends Request
protected function initializeSoapMessage()
{
if($this->server->has('CONTENT_TYPE')) {
if ($this->server->has('CONTENT_TYPE')) {
$type = $this->splitContentTypeHeader($this->server->get('CONTENT_TYPE'));
switch($type['_type']) {
switch ($type['_type']) {
case 'multipart/related':
if($type['type'] == 'application/xop+xml') {
if ($type['type'] == 'application/xop+xml') {
return $this->initializeMtomSoapMessage($type, $this->getContent());
} else {
//log error
@ -114,7 +114,7 @@ class SoapRequest extends Request
protected function initializeMtomSoapMessage(array $contentTypeHeader, $content)
{
if(!isset($contentTypeHeader['start']) || !isset($contentTypeHeader['start-info']) || !isset($contentTypeHeader['boundary'])) {
if (!isset($contentTypeHeader['start']) || !isset($contentTypeHeader['start-info']) || !isset($contentTypeHeader['boundary'])) {
throw new \InvalidArgumentException();
}
@ -129,11 +129,11 @@ class SoapRequest extends Request
// TODO: add more checks to achieve full compatibility to MTOM spec
// http://www.w3.org/TR/soap12-mtom/
if($rootPart->id != $soapMimePartId || $rootPartType['_type'] != 'application/xop+xml' || $rootPartType['type'] != $soapMimePartType) {
if ($rootPart->id != $soapMimePartId || $rootPartType['_type'] != 'application/xop+xml' || $rootPartType['type'] != $soapMimePartType) {
throw new \InvalidArgumentException();
}
foreach($mimeParts as $mimePart) {
foreach ($mimeParts as $mimePart) {
$this->soapAttachments->add(new SoapAttachment(
$mimePart->id,
$mimePart->type,
@ -153,7 +153,7 @@ class SoapRequest extends Request
$result['_type'] = array_shift($parts);
foreach($parts as $part) {
foreach ($parts as $part) {
list($key, $value) = explode('=', trim($part), 2);
$result[$key] = trim($value, '"');

View File

@ -21,7 +21,7 @@ class Assert
public static function thatArgument($name, $condition, $message = self::ARGUMENT_INVALID)
{
if(!$condition) {
if (!$condition) {
throw new \InvalidArgumentException(sprintf($message, $name));
}
}

View File

@ -15,7 +15,7 @@ namespace BeSimple\SoapBundle\Util;
*
* @author Christian Kerl <christian-kerl@web.de>
*/
class String
class BsString
{
/**
* Checks if a string starts with a given string.
@ -27,7 +27,7 @@ class String
*/
public static function startsWith($str, $substr)
{
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
if (is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
return $substr == substr($str, 0, strlen($substr));
}
}
@ -42,8 +42,8 @@ class String
*/
public static function endsWith($str, $substr)
{
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
if (is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
return $substr == substr($str, strlen($str) - strlen($substr));
}
}
}
}

View File

@ -62,4 +62,4 @@ class Collection implements \IteratorAggregate, \Countable
{
return new \ArrayIterator($this->elements);
}
}
}

View File

@ -13,8 +13,6 @@ namespace BeSimple\SoapBundle;
use BeSimple\SoapBundle\ServiceBinding\ServiceBinder;
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
use BeSimple\SoapCommon\SoapOptionsBuilder;
use BeSimple\SoapServer\SoapServerOptionsBuilder;
use BeSimple\SoapWsdl\Dumper\Dumper;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\Config\ConfigCache;
@ -70,10 +68,10 @@ class WebServiceContext
public function getWsdlFile($endpoint = null)
{
$file = sprintf ('%s/%s.%s.wsdl', $this->options['cache_dir'], $this->options['name'], md5($endpoint));
$file = sprintf('%s/%s.%s.wsdl', $this->options['cache_dir'], $this->options['name'], md5($endpoint));
$cache = new ConfigCache($file, $this->options['debug']);
if(!$cache->isFresh()) {
if (!$cache->isFresh()) {
$definition = $this->getServiceDefinition();
if ($endpoint) {
@ -104,14 +102,15 @@ class WebServiceContext
public function getServerBuilder()
{
if (null === $this->serverBuilder) {
$soapServerBuilder = new SoapServerBuilder();
$this->serverBuilder = $soapServerBuilder->build(
SoapServerOptionsBuilder::createWithDefaults(),
SoapOptionsBuilder::createWithClassMap(
$this->getWsdlFile(),
$this->getServiceDefinition()->getTypeRepository()->getClassmap()
)
);
$this->serverBuilder = SoapServerBuilder::createWithDefaults()
->withWsdl($this->getWsdlFile())
->withClassmap($this->getServiceDefinition()->getTypeRepository()->getClassmap())
->withTypeConverters($this->converters)
;
if (null !== $this->options['cache_type']) {
$this->serverBuilder->withWsdlCache($this->options['cache_type']);
}
}
return $this->serverBuilder;

View File

@ -22,16 +22,16 @@
"require": {
"php": ">=5.3.0",
"ext-soap": "*",
"besimple/soap-common": "0.3.*",
"besimple/soap-wsdl": "0.3.*",
"besimple/soap-common": "0.2.*",
"besimple/soap-wsdl": "0.2.*",
"ass/xmlsecurity": "~1.0",
"symfony/framework-bundle": "~2.6",
"symfony/twig-bundle": "~2.6",
"symfony/framework-bundle": "~2.0|~3.0",
"symfony/twig-bundle": "~2.0|~3.0",
"zendframework/zend-mime": "2.1.*"
},
"suggest": {
"besimple/soap-client": "0.3.*",
"besimple/soap-server": "0.3.*"
"besimple/soap-client": "0.2.*",
"besimple/soap-server": "0.2.*"
},
"autoload": {
"psr-0": { "BeSimple\\SoapBundle": "" }
@ -39,7 +39,7 @@
"target-dir": "BeSimple/SoapBundle",
"extra": {
"branch-alias": {
"dev-master": "0.3-dev"
"dev-master": "0.2-dev"
}
}
}

View File

@ -0,0 +1,333 @@
<?php
/*
* This file is part of the BeSimpleSoapClient.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient;
/**
* cURL wrapper class for doing HTTP requests that uses the soap class options.
*
* @author Andreas Schamberger <mail@andreass.net>
*/
class Curl
{
/**
* HTTP User Agent.
*
* @var string
*/
const USER_AGENT = 'PHP-SOAP/\BeSimple\SoapClient';
/**
* Curl resource.
*
* @var resource
*/
private $ch;
/**
* Maximum number of location headers to follow.
*
* @var int
*/
private $followLocationMaxRedirects;
/**
* Request response data.
*
* @var string
*/
private $response;
/**
* Constructor.
*
* @param array $options Options array from SoapClient constructor
* @param int $followLocationMaxRedirects Redirection limit for Location header
*/
public function __construct(array $options = array(), $followLocationMaxRedirects = 10)
{
// set the default HTTP user agent
if (!isset($options['user_agent'])) {
$options['user_agent'] = self::USER_AGENT;
}
$this->followLocationMaxRedirects = $followLocationMaxRedirects;
// make http request
$this->ch = curl_init();
$curlOptions = array(
CURLOPT_ENCODING => '',
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_FAILONERROR => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HEADER => true,
CURLOPT_USERAGENT => $options['user_agent'],
CURLINFO_HEADER_OUT => true,
);
curl_setopt_array($this->ch, $curlOptions);
if (isset($options['compression']) && !($options['compression'] & SOAP_COMPRESSION_ACCEPT)) {
curl_setopt($this->ch, CURLOPT_ENCODING, 'identity');
}
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 10);
if (isset($options['proxy_host'])) {
if (false !== $options['proxy_host']) {
$proxyHost = $options['proxy_host'].(isset($options['proxy_port']) ? $options['proxy_port'] : 8080);
} else {
$proxyHost = false;
}
curl_setopt($this->ch, CURLOPT_PROXY, $proxyHost);
if (false !== $proxyHost && isset($options['proxy_login'])) {
curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_login'].':'.$options['proxy_password']);
if (isset($options['proxy_auth'])) {
curl_setopt($this->ch, CURLOPT_PROXYAUTH, $options['proxy_auth']);
}
}
}
if (isset($options['login'])) {
curl_setopt($this->ch, CURLOPT_HTTPAUTH, isset($options['extra_options']['http_auth']) ? $options['extra_options']['http_auth'] : CURLAUTH_ANY);
curl_setopt($this->ch, CURLOPT_USERPWD, $options['login'].':'.$options['password']);
}
if (isset($options['local_cert'])) {
curl_setopt($this->ch, CURLOPT_SSLCERT, $options['local_cert']);
curl_setopt($this->ch, CURLOPT_SSLCERTPASSWD, $options['passphrase']);
}
if (isset($options['ca_info'])) {
curl_setopt($this->ch, CURLOPT_CAINFO, $options['ca_info']);
}
if (isset($options['ca_path'])) {
curl_setopt($this->ch, CURLOPT_CAPATH, $options['ca_path']);
}
}
/**
* Destructor.
*/
public function __destruct()
{
curl_close($this->ch);
}
/**
* Execute HTTP request.
* Returns true if request was successfull.
*
* @param string $location HTTP location
* @param string $request Request body
* @param array $requestHeaders Request header strings
* @param array $requestOptions An array of request options
*
* @return bool
*/
public function exec($location, $request = null, $requestHeaders = array(), $requestOptions = array())
{
curl_setopt($this->ch, CURLOPT_URL, $location);
if (!is_null($request)) {
curl_setopt($this->ch, CURLOPT_POST, true);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $request);
}
if (count($requestHeaders) > 0) {
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $requestHeaders);
}
if (count($requestOptions) > 0) {
curl_setopt_array($this->ch, $requestOptions);
}
$this->response = $this->execManualRedirect();
return ($this->response === false) ? false : true;
}
/**
* Custom curl_exec wrapper that allows to follow redirects when specific
* http response code is set. SOAP only allows 307.
*
* @param int $redirects Current redirection count
*
* @return mixed
*/
private function execManualRedirect($redirects = 0)
{
if ($redirects > $this->followLocationMaxRedirects) {
// TODO Redirection limit reached, aborting
return false;
}
curl_setopt($this->ch, CURLOPT_HEADER, true);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($this->ch);
$httpResponseCode = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
if ($httpResponseCode == 307) {
$headerSize = curl_getinfo($this->ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $headerSize);
$matches = array();
preg_match('/Location:(.*?)\n/', $header, $matches);
$url = trim(array_pop($matches));
// @parse_url to suppress E_WARNING for invalid urls
if (($url = @parse_url($url)) !== false) {
$lastUrl = parse_url(curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL));
if (!isset($url['scheme'])) {
$url['scheme'] = $lastUrl['scheme'];
}
if (!isset($url['host'])) {
$url['host'] = $lastUrl['host'];
}
if (!isset($url['path'])) {
$url['path'] = $lastUrl['path'];
}
$newUrl = $url['scheme'].'://'.$url['host'].$url['path'].($url['query'] ? '?'.$url['query'] : '');
curl_setopt($this->ch, CURLOPT_URL, $newUrl);
return $this->execManualRedirect($redirects++);
}
}
return $response;
}
/**
* Error code mapping from cURL error codes to PHP ext/soap error messages
* (where applicable).
*
* http://curl.haxx.se/libcurl/c/libcurl-errors.html
*
* @return array(int=>string)
*/
protected function getErrorCodeMapping()
{
return array(
1 => 'Unknown protocol. Only http and https are allowed.', //CURLE_UNSUPPORTED_PROTOCOL
3 => 'Unable to parse URL', //CURLE_URL_MALFORMAT
5 => 'Could not connect to host', //CURLE_COULDNT_RESOLVE_PROXY
6 => 'Could not connect to host', //CURLE_COULDNT_RESOLVE_HOST
7 => 'Could not connect to host', //CURLE_COULDNT_CONNECT
9 => 'Could not connect to host', //CURLE_REMOTE_ACCESS_DENIED
28 => 'Failed Sending HTTP SOAP request', //CURLE_OPERATION_TIMEDOUT
35 => 'Could not connect to host', //CURLE_SSL_CONNECT_ERROR
41 => 'Can\'t uncompress compressed response', //CURLE_FUNCTION_NOT_FOUND
51 => 'Could not connect to host', //CURLE_PEER_FAILED_VERIFICATION
52 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_GOT_NOTHING
53 => 'SSL support is not available in this build', //CURLE_SSL_ENGINE_NOTFOUND
54 => 'SSL support is not available in this build', //CURLE_SSL_ENGINE_SETFAILED
55 => 'Failed Sending HTTP SOAP request', //CURLE_SEND_ERROR
56 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_RECV_ERROR
58 => 'Could not connect to host', //CURLE_SSL_CERTPROBLEM
59 => 'Could not connect to host', //CURLE_SSL_CIPHER
60 => 'Could not connect to host', //CURLE_SSL_CACERT
61 => 'Unknown Content-Encoding', //CURLE_BAD_CONTENT_ENCODING
65 => 'Failed Sending HTTP SOAP request', //CURLE_SEND_FAIL_REWIND
66 => 'SSL support is not available in this build', //CURLE_SSL_ENGINE_INITFAILED
67 => 'Could not connect to host', //CURLE_LOGIN_DENIED
77 => 'Could not connect to host', //CURLE_SSL_CACERT_BADFILE
80 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_SSL_SHUTDOWN_FAILED
);
}
/**
* Gets the curl error message.
*
* @return string
*/
public function getErrorMessage()
{
$errorCodeMapping = $this->getErrorCodeMapping();
$errorNumber = curl_errno($this->ch);
if (isset($errorCodeMapping[$errorNumber])) {
return $errorCodeMapping[$errorNumber];
}
return curl_error($this->ch);
}
/**
* Gets the request headers as a string.
*
* @return string
*/
public function getRequestHeaders()
{
return curl_getinfo($this->ch, CURLINFO_HEADER_OUT);
}
/**
* Gets the whole response (including headers) as a string.
*
* @return string
*/
public function getResponse()
{
return $this->response;
}
/**
* Gets the response body as a string.
*
* @return string
*/
public function getResponseBody()
{
$headerSize = curl_getinfo($this->ch, CURLINFO_HEADER_SIZE);
return substr($this->response, $headerSize);
}
/**
* Gets the response content type.
*
* @return string
*/
public function getResponseContentType()
{
return curl_getinfo($this->ch, CURLINFO_CONTENT_TYPE);
}
/**
* Gets the response headers as a string.
*
* @return string
*/
public function getResponseHeaders()
{
$headerSize = curl_getinfo($this->ch, CURLINFO_HEADER_SIZE);
return substr($this->response, 0, $headerSize);
}
/**
* Gets the response http status code.
*
* @return string
*/
public function getResponseStatusCode()
{
return curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
}
/**
* Gets the response http status message.
*
* @return string
*/
public function getResponseStatusMessage()
{
preg_match('/HTTP\/(1\.[0-1]+) ([0-9]{3}) (.*)/', $this->response, $matches);
return trim(array_pop($matches));
}
}

View File

@ -1,237 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationBasicOptions;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationDigestOptions;
use BeSimple\SoapClient\Curl\Http\SslCertificateOptions;
use Exception;
class Curl
{
const CURL_SUCCESS = true;
const CURL_FAILED = false;
private $curlSession;
private $options;
/**
* @param CurlOptions $options
*/
public function __construct(CurlOptions $options)
{
$this->curlSession = $this->acquireNewCurlSession($options);
$this->options = $options;
}
public function __destruct()
{
$this->closeCurlSession($this->curlSession);
}
/**
* @param string $location HTTP location
* @param string $request Request body
* @param array $requestHeaders Request header strings
* @return CurlResponse
*/
public function executeCurlWithCachedSession($location, $request = null, $requestHeaders = [])
{
return $this->executeCurlSession($this->curlSession, $this->options, $location, $request, $requestHeaders);
}
/**
* @param CurlOptions $options
* @param string $location HTTP location
* @param string $request Request body
* @param array $requestHeaders Request header strings
* @return CurlResponse
*/
public function executeCurl(CurlOptions $options, $location, $request = null, $requestHeaders = [])
{
$curlSession = $this->acquireNewCurlSession($options);
$curlResponse = $this->executeCurlSession($curlSession, $options, $location, $request, $requestHeaders);
$this->closeCurlSession($curlSession);
return $curlResponse;
}
private function acquireNewCurlSession(CurlOptions $options)
{
$curlSession = curl_init();
curl_setopt_array($curlSession, [
CURLOPT_ENCODING => '',
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_FAILONERROR => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HEADER => true,
CURLOPT_USERAGENT => $options->getUserAgent(),
CURLINFO_HEADER_OUT => true,
CURLOPT_CONNECTTIMEOUT => $options->getConnectionTimeout()
]);
return $curlSession;
}
private function closeCurlSession($curlSession)
{
curl_close($curlSession);
}
/**
* @param mixed $curlSession Result of curl_init() handle
* @param CurlOptions $options
* @param string $location HTTP location
* @param string $request Request body
* @param array $requestHeaders Request header strings
* @return CurlResponse
*/
private function executeCurlSession($curlSession, CurlOptions $options, $location, $request = null, $requestHeaders = [])
{
curl_setopt($curlSession, CURLOPT_URL, $location);
curl_setopt($curlSession, CURLOPT_HEADER, true);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
if (!is_null($request)) {
curl_setopt($curlSession, CURLOPT_POST, true);
curl_setopt($curlSession, CURLOPT_POSTFIELDS, $request);
} else {
curl_setopt($curlSession, CURLOPT_POST, false);
}
if (count($requestHeaders) > 0) {
curl_setopt($curlSession, CURLOPT_HTTPHEADER, $requestHeaders);
}
if (!$options->getSoapCompression() & SOAP_COMPRESSION_ACCEPT) {
curl_setopt($curlSession, CURLOPT_ENCODING, 'identity');
}
if ($options->hasProxy()) {
$proxyHost = $options->getProxy()->getHost() . $options->getProxy()->getPort();
curl_setopt($curlSession, CURLOPT_PROXY, $proxyHost);
if ($options->getProxy()->hasCredentials()) {
curl_setopt($curlSession, CURLOPT_PROXYUSERPWD, $options->getProxy()->getLogin() . ':' . $options->getProxy()->getPassword());
if ($options->getProxy()->hasAuthenticationType()) {
curl_setopt($curlSession, CURLOPT_PROXYAUTH, $options->getProxy()->getAuthenticationType());
}
}
}
if ($options->hasHttpAuthentication()) {
if ($options->hasHttpAuthenticationBasic()) {
/** @var HttpAuthenticationBasicOptions $httpAuthenticationBasic */
$httpAuthenticationBasic = $options->getHttpAuthentication();
curl_setopt($curlSession, CURLOPT_HTTPAUTH, $httpAuthenticationBasic->getAuthenticationType());
curl_setopt($curlSession, CURLOPT_USERPWD, $httpAuthenticationBasic->getUsername() . ':' . $httpAuthenticationBasic->getPassword());
} else if ($options->hasHttpAuthenticationDigest()) {
/** @var HttpAuthenticationDigestOptions $httpAuthenticationDigest */
$httpAuthenticationDigest = $options->getHttpAuthentication();
curl_setopt($curlSession, CURLOPT_HTTPAUTH, $httpAuthenticationDigest->getAuthenticationType());
} else {
throw new Exception('Unresolved authentication type: '.get_class($options->getHttpAuthentication()));
}
}
if ($options->hasSslCertificateOptions()) {
$sslCertificateOptions = $options->getSslCertificateOptions();
curl_setopt($curlSession, CURLOPT_SSLCERT, $sslCertificateOptions->getCertificateLocalPath());
if ($sslCertificateOptions->hasCertificatePassPhrase()) {
curl_setopt($curlSession, CURLOPT_SSLCERTPASSWD, $sslCertificateOptions->getCertificatePassPhrase());
}
if ($sslCertificateOptions->hasCertificateAuthorityInfo()) {
curl_setopt($curlSession, CURLOPT_CAINFO, $sslCertificateOptions->getCertificateAuthorityInfo());
}
if ($sslCertificateOptions->hasCertificateAuthorityPath()) {
curl_setopt($curlSession, CURLOPT_CAPATH, $sslCertificateOptions->hasCertificateAuthorityPath());
}
}
$executeSoapCallResponse = $this->executeHttpCall($curlSession, $options);
$httpRequestHeadersAsString = curl_getinfo($curlSession, CURLINFO_HEADER_OUT);
$headerSize = curl_getinfo($curlSession, CURLINFO_HEADER_SIZE);
$httpResponseCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
$httpResponseContentType = curl_getinfo($curlSession, CURLINFO_CONTENT_TYPE);;
$responseBody = substr($executeSoapCallResponse, $headerSize);
$responseHeaders = substr($executeSoapCallResponse, 0, $headerSize);
preg_match('/HTTP\/(1\.[0-1]+) ([0-9]{3}) (.*)/', $executeSoapCallResponse, $httpResponseMessages);
$httpResponseMessage = trim(array_pop($httpResponseMessages));
$curlErrorMessage = sprintf(
'Curl error "%s" with message: %s occurred while connecting to %s',
curl_errno($curlSession),
curl_error($curlSession),
$location
);
if (!is_integer($httpResponseCode) || $httpResponseCode >= 400 || $httpResponseCode === 0) {
return new CurlResponse(
$httpRequestHeadersAsString,
$httpResponseCode,
$httpResponseMessage,
$httpResponseContentType,
self::CURL_FAILED,
$responseHeaders,
$responseBody,
$curlErrorMessage
);
}
return new CurlResponse(
$httpRequestHeadersAsString,
$httpResponseCode,
$httpResponseMessage,
$httpResponseContentType,
self::CURL_SUCCESS,
$responseHeaders,
$responseBody
);
}
/**
* Custom curl_exec wrapper that allows to follow redirects when specific
* http response code is set. SOAP only allows 307.
*
* @param mixed $curlSession Result of curl_init() handle
* @param CurlOptions $options
* @param int $executedRedirects
* @return string|null
* @throws Exception
*/
private function executeHttpCall($curlSession, CurlOptions $options, $executedRedirects = 0)
{
if ($executedRedirects > $options->getFollowLocationMaxRedirects()) {
throw new Exception('Cannot executeHttpCall - too many redirects: ' . $executedRedirects);
}
$curlExecResponse = curl_exec($curlSession);
$httpResponseCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
if ($httpResponseCode === 307) {
$newUrl = $this->getRedirectUrlFromResponseHeaders($curlSession, $curlExecResponse);
curl_setopt($curlSession, CURLOPT_URL, $newUrl);
return $this->executeHttpCall($curlSession, $options, ++$executedRedirects);
}
return $curlExecResponse;
}
private function getRedirectUrlFromResponseHeaders($curlSession, $curlExecResponse)
{
$curlExecResponseHeaders = substr($curlExecResponse, 0, curl_getinfo($curlSession, CURLINFO_HEADER_SIZE));
$matches = [];
preg_match('/Location:(.*?)\n/', $curlExecResponseHeaders, $matches);
$url = trim(array_pop($matches));
if (($url = @parse_url($url)) !== false) {
$lastUrl = parse_url(curl_getinfo($curlSession, CURLINFO_EFFECTIVE_URL));
if (!isset($url['scheme'])) {
$url['scheme'] = $lastUrl['scheme'];
}
if (!isset($url['host'])) {
$url['host'] = $lastUrl['host'];
}
if (!isset($url['path'])) {
$url['path'] = $lastUrl['path'];
}
return $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query'] ? '?' . $url['query'] : '');
}
throw new Exception('Cannot parse WSDL url redirect: ' . $url);
}
}

View File

@ -1,126 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationDigestOptions;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationInterface;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationBasicOptions;
use BeSimple\SoapClient\Curl\Http\SslCertificateOptions;
use BeSimple\SoapClient\SoapServerProxy\SoapServerProxy;
class CurlOptions
{
const DEFAULT_USER_AGENT = 'PhpBeSimpleSoap';
const SOAP_COMPRESSION_NONE = null;
const SOAP_COMPRESSION_GZIP = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
const SOAP_COMPRESSION_DEFLATE = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE;
private $userAgent;
private $followLocationMaxRedirects;
private $soapCompression;
private $connectionTimeout;
private $proxy;
private $httpAuthentication;
private $sslCertificateOptions;
/**
* @param string $userAgent
* @param int $followLocationMaxRedirects
* @param CurlOptions::SOAP_COMPRESSION_NONE|CurlOptions::SOAP_COMPRESSION_GZIP|CurlOptions::SOAP_COMPRESSION_DEFLATE $soapCompression
* @param int $connectionTimeout
* @param SoapServerProxy|null $proxy
* @param HttpAuthenticationInterface|null $httpAuthentication
* @param SslCertificateOptions|null $sslCertificateOptions
*/
public function __construct(
$userAgent,
$followLocationMaxRedirects,
$soapCompression,
$connectionTimeout,
SoapServerProxy $proxy = null,
HttpAuthenticationInterface $httpAuthentication = null,
SslCertificateOptions $sslCertificateOptions = null
) {
$this->userAgent = $userAgent;
$this->followLocationMaxRedirects = $followLocationMaxRedirects;
$this->soapCompression = $soapCompression;
$this->connectionTimeout = $connectionTimeout;
$this->proxy = $proxy;
$this->httpAuthentication = $httpAuthentication;
$this->sslCertificateOptions = $sslCertificateOptions;
}
public function getUserAgent()
{
return $this->userAgent;
}
public function getFollowLocationMaxRedirects()
{
return $this->followLocationMaxRedirects;
}
public function getSoapCompression()
{
return $this->soapCompression;
}
public function getConnectionTimeout()
{
return $this->connectionTimeout;
}
public function getProxy()
{
return $this->proxy;
}
public function getHttpAuthentication()
{
return $this->httpAuthentication;
}
public function getSslCertificateOptions()
{
return $this->sslCertificateOptions;
}
public function hasProxy()
{
return $this->proxy !== null;
}
public function hasHttpAuthentication()
{
return $this->httpAuthentication !== null;
}
public function hasSslCertificateOptions()
{
return $this->sslCertificateOptions !== null;
}
public function hasHttpAuthenticationBasic()
{
if ($this->hasHttpAuthentication()) {
if ($this->getHttpAuthentication() instanceof HttpAuthenticationBasicOptions) {
return true;
}
}
return false;
}
public function hasHttpAuthenticationDigest()
{
if ($this->hasHttpAuthentication()) {
if ($this->getHttpAuthentication() instanceof HttpAuthenticationDigestOptions) {
return true;
}
}
return false;
}
}

View File

@ -1,79 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationDigestOptions;
use BeSimple\SoapClient\Curl\Http\SslCertificateOptions;
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
use BeSimple\SoapClient\SoapServerAuthentication\SoapServerAuthenticationBasic;
use BeSimple\SoapClient\SoapServerAuthentication\SoapServerAuthenticationDigest;
use BeSimple\SoapClient\Curl\Http\HttpAuthenticationBasicOptions;
use Exception;
class CurlOptionsBuilder
{
const DEFAULT_MAX_REDIRECTS = 10;
const DEFAULT_CONNECTION_TIMEOUT = 120;
public static function buildDefault()
{
return new CurlOptions(
CurlOptions::DEFAULT_USER_AGENT,
self::DEFAULT_MAX_REDIRECTS,
CurlOptions::SOAP_COMPRESSION_NONE,
self::DEFAULT_CONNECTION_TIMEOUT
);
}
public static function buildForSoapClient(SoapClientOptions $soapClientOptions)
{
return new CurlOptions(
$soapClientOptions->getUserAgent(),
self::DEFAULT_MAX_REDIRECTS,
$soapClientOptions->getCompression(),
self::DEFAULT_CONNECTION_TIMEOUT,
$soapClientOptions->getProxy(),
self::getHttpAuthOptions($soapClientOptions),
self::getSslCertificateOptions($soapClientOptions)
);
}
private static function getHttpAuthOptions(SoapClientOptions $soapClientOptions)
{
if ($soapClientOptions->hasAuthentication()) {
if ($soapClientOptions->hasAuthenticationBasic()) {
/** @var SoapServerAuthenticationBasic $basicAuthentication */
$basicAuthentication = $soapClientOptions->getAuthentication();
return new HttpAuthenticationBasicOptions(
$basicAuthentication->getLogin(),
$basicAuthentication->getPassword()
);
} else if ($soapClientOptions->hasAuthenticationDigest()) {
return new HttpAuthenticationDigestOptions();
} else {
throw new Exception('Unresolved authentication type: '.get_class($soapClientOptions->getAuthentication()));
}
}
return null;
}
private static function getSslCertificateOptions(SoapClientOptions $soapClientOptions)
{
if ($soapClientOptions->hasAuthenticationDigest()) {
/** @var SoapServerAuthenticationDigest $digestAuthentication */
$digestAuthentication = $soapClientOptions->getAuthentication();
return new SslCertificateOptions(
$digestAuthentication->getLocalCert(),
$digestAuthentication->getPassPhrase()
);
}
return null;
}
}

View File

@ -1,90 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl;
class CurlResponse
{
private $httpRequestHeaders;
private $httpResponseStatusCode;
private $httpResponseStatusMessage;
private $httpResponseContentType;
private $curlStatus;
private $curlErrorMessage;
private $responseHeader;
private $responseBody;
public function __construct(
$httpRequestHeaders,
$httpResponseStatusCode,
$httpResponseStatusMessage,
$httpResponseContentType,
$curlStatus,
$responseHeader,
$responseBody,
$curlErrorMessage = null
) {
$this->httpRequestHeaders = $httpRequestHeaders;
$this->httpResponseStatusCode = $httpResponseStatusCode;
$this->httpResponseStatusMessage = $httpResponseStatusMessage;
$this->httpResponseContentType = $httpResponseContentType;
$this->curlStatus = $curlStatus;
$this->curlErrorMessage = $curlErrorMessage;
$this->responseHeader = $responseHeader;
$this->responseBody = $responseBody;
}
public function getHttpRequestHeaders()
{
return $this->httpRequestHeaders;
}
public function getHttpResponseStatusCode()
{
return $this->httpResponseStatusCode;
}
public function getHttpResponseStatusMessage()
{
return $this->httpResponseStatusMessage;
}
public function getHttpResponseContentType()
{
return $this->httpResponseContentType;
}
public function getCurlStatus()
{
return $this->curlStatus;
}
public function curlStatusSuccess()
{
return $this->curlStatus === Curl::CURL_SUCCESS;
}
public function curlStatusFailed()
{
return $this->curlStatus === Curl::CURL_FAILED;
}
public function hasCurlErrorMessage()
{
return $this->curlErrorMessage !== null;
}
public function getCurlErrorMessage()
{
return $this->curlErrorMessage;
}
public function getResponseHeader()
{
return $this->responseHeader;
}
public function getResponseBody()
{
return $this->responseBody;
}
}

View File

@ -1,34 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl\Http;
class HttpAuthenticationBasicOptions implements HttpAuthenticationInterface
{
private $username;
private $password;
/**
* @param string $username
* @param string $password
*/
public function __construct($username, $password)
{
$this->username = $username;
$this->password = $password;
}
public function getUsername()
{
return $this->username;
}
public function getPassword()
{
return $this->password;
}
public function getAuthenticationType()
{
return HttpAuthenticationInterface::AUTHENTICATION_TYPE_BASIC;
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl\Http;
class HttpAuthenticationDigestOptions implements HttpAuthenticationInterface
{
public function getAuthenticationType()
{
return HttpAuthenticationInterface::AUTHENTICATION_TYPE_DIGEST;
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl\Http;
interface HttpAuthenticationInterface
{
const AUTHENTICATION_TYPE_ANY = CURLAUTH_ANY;
const AUTHENTICATION_TYPE_BASIC = CURLAUTH_BASIC;
const AUTHENTICATION_TYPE_DIGEST = CURLAUTH_DIGEST;
/**
* @return string choice from self::AUTHENTICATION_TYPE_ANY|self::AUTHENTICATION_TYPE_BASIC|self::AUTHENTICATION_TYPE_DIGEST
*/
public function getAuthenticationType();
}

View File

@ -1,64 +0,0 @@
<?php
namespace BeSimple\SoapClient\Curl\Http;
class SslCertificateOptions
{
private $certificateLocalPath;
private $certificatePassPhrase;
private $certificateAuthorityInfo;
private $certificateAuthorityPath;
/**
* @param string $certificateLocalPath
* @param string $certificatePassPhrase
* @param string $certificateAuthorityInfo
* @param string $certificateAuthorityPath
*/
public function __construct(
$certificateLocalPath,
$certificatePassPhrase = null,
$certificateAuthorityInfo = null,
$certificateAuthorityPath = null
) {
$this->certificateLocalPath = $certificateLocalPath;
$this->certificatePassPhrase = $certificatePassPhrase;
$this->certificateAuthorityInfo = $certificateAuthorityInfo;
$this->certificateAuthorityPath = $certificateAuthorityPath;
}
public function getCertificateLocalPath()
{
return $this->certificateLocalPath;
}
public function getCertificatePassPhrase()
{
return $this->certificatePassPhrase;
}
public function getCertificateAuthorityInfo()
{
return $this->certificateAuthorityInfo;
}
public function getCertificateAuthorityPath()
{
return $this->certificateAuthorityPath;
}
public function hasCertificatePassPhrase()
{
return $this->certificatePassPhrase !== null;
}
public function hasCertificateAuthorityInfo()
{
return $this->certificateAuthorityInfo !== null;
}
public function hasCertificateAuthorityPath()
{
return $this->certificateAuthorityPath !== null;
}
}

View File

@ -16,10 +16,9 @@ use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\Mime\MultiPart as MimeMultiPart;
use BeSimple\SoapCommon\Mime\Parser as MimeParser;
use BeSimple\SoapCommon\Mime\Part as MimePart;
use BeSimple\SoapCommon\Mime\Part;
use BeSimple\SoapCommon\SoapRequest;
use BeSimple\SoapCommon\SoapRequestFilter;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
use BeSimple\SoapCommon\SoapResponse;
use BeSimple\SoapCommon\SoapResponseFilter;
/**
@ -29,61 +28,111 @@ use BeSimple\SoapCommon\SoapResponseFilter;
*/
class MimeFilter implements SoapRequestFilter, SoapResponseFilter
{
public function filterRequest(SoapRequest $request, $attachmentType)
/**
* Attachment type.
*
* @var int Helper::ATTACHMENTS_TYPE_SWA | Helper::ATTACHMENTS_TYPE_MTOM
*/
protected $attachmentType = Helper::ATTACHMENTS_TYPE_SWA;
/**
* Constructor.
*
* @param int $attachmentType Helper::ATTACHMENTS_TYPE_SWA | Helper::ATTACHMENTS_TYPE_MTOM
*/
public function __construct($attachmentType)
{
$this->attachmentType = $attachmentType;
}
/**
* Reset all properties to default values.
*/
public function resetFilter()
{
$this->attachmentType = Helper::ATTACHMENTS_TYPE_SWA;
}
/**
* Modify the given request XML.
*
* @param \BeSimple\SoapCommon\SoapRequest $request SOAP request
*
* @return void
*/
public function filterRequest(SoapRequest $request)
{
// get attachments from request object
$attachmentsToSend = $request->getAttachments();
// build mime message if we have attachments
if (count($attachmentsToSend) > 0) {
$multipart = new MimeMultiPart('Part_' . rand(10, 15) . '_' . uniqid() . '.' . uniqid());
$multipart = new MimeMultiPart();
$soapPart = new MimePart($request->getContent(), 'text/xml', 'utf-8', MimePart::ENCODING_EIGHT_BIT);
$soapVersion = $request->getVersion();
if ($soapVersion === SOAP_1_1 && $attachmentType & Helper::ATTACHMENTS_TYPE_MTOM) {
// change content type headers for MTOM with SOAP 1.1
if ($soapVersion == SOAP_1_1 && $this->attachmentType & Helper::ATTACHMENTS_TYPE_MTOM) {
$multipart->setHeader('Content-Type', 'type', 'application/xop+xml');
$multipart->setHeader('Content-Type', 'start-info', 'text/xml');
$soapPart->setHeader('Content-Type', 'application/xop+xml');
$soapPart->setHeader('Content-Type', 'type', 'text/xml');
} elseif ($soapVersion === SOAP_1_2) {
}
// change content type headers for SOAP 1.2
elseif ($soapVersion == SOAP_1_2) {
$multipart->setHeader('Content-Type', 'type', 'application/soap+xml');
$soapPart->setHeader('Content-Type', 'application/soap+xml');
}
$multipart->addPart($soapPart, true);
foreach ($attachmentsToSend as $cid => $attachment) {
$multipart->addPart($attachment, false);
}
$request->setContent($multipart->getMimeMessage());
// TODO
$headers = $multipart->getHeadersForHttp();
list(, $contentType) = explode(': ', $headers[0]);
$request->setContentType($contentType);
}
return $request;
}
public function filterResponse(CommonSoapResponse $response, $attachmentType)
/**
* Modify the given response XML.
*
* @param \BeSimple\SoapCommon\SoapResponse $response SOAP response
*
* @return void
*/
public function filterResponse(SoapResponse $response)
{
$multiPartMessage = MimeParser::parseMimeMessage(
$response->getContent(),
['Content-Type' => trim($response->getContentType())]
);
$soapPart = $multiPartMessage->getMainPart();
$attachments = $multiPartMessage->getAttachments();
// array to store attachments
$attachmentsRecieved = array();
$response->setContent($soapPart->getContent());
$response->setContentType($soapPart->getHeader('Content-Type'));
if (count($attachments) > 0) {
$response->setAttachments($attachments);
// check content type if it is a multipart mime message
$responseContentType = $response->getContentType();
if (false !== stripos($responseContentType, 'multipart/related')) {
// parse mime message
$headers = array(
'Content-Type' => trim($responseContentType),
);
$multipart = MimeParser::parseMimeMessage($response->getContent(), $headers);
// get soap payload and update SoapResponse object
$soapPart = $multipart->getPart();
// convert href -> myhref for external references as PHP throws exception in this case
// http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/soap/php_encoding.c?view=markup#l3436
$content = preg_replace('/href=(?!#)/', 'myhref=', $soapPart->getContent());
$response->setContent($content);
$response->setContentType($soapPart->getHeader('Content-Type'));
// store attachments
$attachments = $multipart->getParts(false);
foreach ($attachments as $cid => $attachment) {
$attachmentsRecieved[$cid] = $attachment;
}
}
return $response;
}
private function sanitizePhpExceptionOnHrefs(Part $soapPart)
{
// convert href -> myhref for external references as PHP throws exception in this case
// http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/soap/php_encoding.c?view=markup#l3436
return preg_replace('/href=(?!#)/', 'myhref=', $soapPart->getContent());
// add attachments to response object
if (count($attachmentsRecieved) > 0) {
$response->setAttachments($attachmentsRecieved);
}
}
}

View File

@ -12,22 +12,10 @@
namespace BeSimple\SoapClient;
use BeSimple\SoapBundle\Soap\SoapAttachment;
use BeSimple\SoapBundle\Soap\SoapAttachmentList;
use BeSimple\SoapClient\Curl\Curl;
use BeSimple\SoapClient\Curl\CurlOptionsBuilder;
use BeSimple\SoapClient\Curl\CurlResponse;
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
use BeSimple\SoapCommon\Fault\SoapFaultEnum;
use BeSimple\SoapCommon\Fault\SoapFaultPrefixEnum;
use BeSimple\SoapCommon\Fault\SoapFaultSourceGetter;
use BeSimple\SoapCommon\Mime\PartFactory;
use BeSimple\SoapCommon\SoapKernel;
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use BeSimple\SoapCommon\SoapRequest;
use BeSimple\SoapCommon\SoapRequestFactory;
use Exception;
use SoapFault;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\Converter\MtomTypeConverter;
use BeSimple\SoapCommon\Converter\SwaTypeConverter;
use BeSimple\SoapCommon\SoapMessage;
/**
* Extended SoapClient that uses a a cURL wrapper for all underlying HTTP
@ -36,121 +24,172 @@ use SoapFault;
* allows caching of all remote referenced items.
*
* @author Andreas Schamberger <mail@andreass.net>
* @author Petr Bechyně <mail@petrbechyne.com>
*/
class SoapClient extends \SoapClient
{
/** @var SoapClientOptions */
protected $soapClientOptions;
/** @var SoapOptions */
protected $soapOptions;
/** @var Curl */
private $curl;
/** @var SoapAttachment[] */
private $soapAttachmentsOnRequestStorage;
/** @var SoapResponse */
private $soapResponseStorage;
/**
* Soap version.
*
* @var int
*/
protected $soapVersion = SOAP_1_1;
public function __construct(SoapClientOptions $soapClientOptions, SoapOptions $soapOptions)
/**
* Tracing enabled?
*
* @var boolean
*/
protected $tracingEnabled = false;
/**
* cURL instance.
*
* @var \BeSimple\SoapClient\Curl
*/
protected $curl = null;
/**
* Last request headers.
*
* @var string
*/
private $lastRequestHeaders = '';
/**
* Last request.
*
* @var string
*/
private $lastRequest = '';
/**
* Last response headers.
*
* @var string
*/
private $lastResponseHeaders = '';
/**
* Last response.
*
* @var string
*/
private $lastResponse = '';
/**
* Soap kernel.
*
* @var \BeSimple\SoapClient\SoapKernel
*/
protected $soapKernel = null;
/**
* Constructor.
*
* @param string $wsdl WSDL file
* @param array(string=>mixed) $options Options array
*/
public function __construct($wsdl, array $options = array())
{
$this->soapClientOptions = $soapClientOptions;
$this->soapOptions = $soapOptions;
$this->curl = new Curl(
CurlOptionsBuilder::buildForSoapClient($soapClientOptions)
);
try {
$wsdlPath = $this->loadWsdl(
$this->curl,
$soapOptions->getWsdlFile(),
$soapOptions->getWsdlCacheType(),
false
);
} catch (Exception $e) {
throw new SoapFault(
SoapFaultEnum::SOAP_FAULT_SOAP_CLIENT_ERROR,
'Unable to load WsdlPath ('.$soapOptions->getWsdlFile().') with message: '.$e->getMessage().' in file: '.$e->getFile().' (line: '.$e->getLine().')'
);
// tracing enabled: store last request/response header and body
if (isset($options['trace']) && $options['trace'] === true) {
$this->tracingEnabled = true;
}
// store SOAP version
if (isset($options['soap_version'])) {
$this->soapVersion = $options['soap_version'];
}
@parent::__construct($wsdlPath, $soapClientOptions->toArray() + $soapOptions->toArray());
$this->curl = new Curl($options);
if (isset($options['extra_options'])) {
unset($options['extra_options']);
}
$wsdlFile = $this->loadWsdl($wsdl, $options);
// TODO $wsdlHandler = new WsdlHandler($wsdlFile, $this->soapVersion);
$this->soapKernel = new SoapKernel();
// set up type converter and mime filter
$this->configureMime($options);
// we want the exceptions option to be set
$options['exceptions'] = true;
// disable obsolete trace option for native SoapClient as we need to do our own tracing anyways
$options['trace'] = false;
// disable WSDL caching as we handle WSDL caching for remote URLs ourself
$options['cache_wsdl'] = WSDL_CACHE_NONE;
parent::__construct($wsdlFile, $options);
}
/**
* Avoid using __call directly, it's deprecated even in \SoapClient.
* Perform HTTP request with cURL.
*
* @deprecated
*/
public function __call($function_name, $arguments)
{
throw new Exception(
'The __call method is deprecated. Use __soapCall/soapCall instead.'
);
}
/**
* Using __soapCall returns only response string, use soapCall instead.
* @param SoapRequest $soapRequest SoapRequest object
*
* @param string $function_name
* @param array $arguments
* @param array|null $options
* @param null $input_headers
* @param array|null $output_headers
* @return string
*/
public function __soapCall($function_name, $arguments, $options = null, $input_headers = null, &$output_headers = null)
{
return $this->soapCall($function_name, $arguments, $options, $input_headers, $output_headers)->getResponseContent();
}
/**
* @param string $functionName
* @param array $arguments
* @param array|null $options
* @param SoapAttachment[] $soapAttachments
* @param null $inputHeaders
* @param array|null $outputHeaders
* @return SoapResponse
*/
public function soapCall($functionName, array $arguments, array $soapAttachments = [], array $options = null, $inputHeaders = null, array &$outputHeaders = null)
private function __doHttpRequest(SoapRequest $soapRequest)
{
$this->setSoapAttachmentsOnRequestToStorage($soapAttachments);
try {
$soapResponseAsObject = parent::__soapCall($functionName, $arguments, $options, $inputHeaders, $outputHeaders);
$soapResponse = $this->getSoapResponseFromStorage();
$soapResponse->setResponseObject($soapResponseAsObject);
return $soapResponse;
} catch (SoapFault $soapFault) {
if (SoapFaultSourceGetter::isNativeSoapFault($soapFault)) {
$soapResponse = $this->getSoapResponseFromStorage();
if ($soapResponse instanceof SoapResponse) {
$soapFault = $this->throwSoapFaultByTracing(
SoapFaultPrefixEnum::PREFIX_PHP . '-' . $soapFault->getCode(),
$soapFault->getMessage(),
new SoapResponseTracingData(
'Content-Type: ' . $soapResponse->getRequest()->getContentType(),
$soapResponse->getRequest()->getContent(),
'Content-Type: ' . $soapResponse->getContentType(),
$soapResponse->getResponseContent()
)
);
} else {
$soapFault = new SoapFault(
SoapFaultPrefixEnum::PREFIX_PHP . '-unresolved',
'Got SoapFault message with no response: '.$soapFault->getMessage()
);
}
}
throw $soapFault;
// HTTP headers
$soapVersion = $soapRequest->getVersion();
$soapAction = $soapRequest->getAction();
if (SOAP_1_1 == $soapVersion) {
$headers = array(
'Content-Type:' . $soapRequest->getContentType(),
'SOAPAction: "' . $soapAction . '"',
);
} else {
$headers = array(
'Content-Type:' . $soapRequest->getContentType() . '; action="' . $soapAction . '"',
);
}
$location = $soapRequest->getLocation();
$content = $soapRequest->getContent();
$headers = $this->filterRequestHeaders($soapRequest, $headers);
$options = $this->filterRequestOptions($soapRequest);
// execute HTTP request with cURL
$responseSuccessfull = $this->curl->exec(
$location,
$content,
$headers,
$options
);
// tracing enabled: store last request header and body
if ($this->tracingEnabled === true) {
$this->lastRequestHeaders = $this->curl->getRequestHeaders();
$this->lastRequest = $soapRequest->getContent();
}
// in case of an error while making the http request throw a soapFault
if ($responseSuccessfull === false) {
// get error message from curl
$faultstring = $this->curl->getErrorMessage();
throw new \SoapFault('HTTP', $faultstring);
}
// tracing enabled: store last response header and body
if ($this->tracingEnabled === true) {
$this->lastResponseHeaders = $this->curl->getResponseHeaders();
$this->lastResponse = $this->curl->getResponseBody();
}
// wrap response data in SoapResponse object
$soapResponse = SoapResponse::create(
$this->curl->getResponseBody(),
$soapRequest->getLocation(),
$soapRequest->getAction(),
$soapRequest->getVersion(),
$this->curl->getResponseContentType()
);
return $soapResponse;
}
/**
* This is not performing any HTTP requests, but it is getting data from SoapClient that are needed for this Client
* Custom request method to be able to modify the SOAP messages.
* $oneWay parameter is not used at the moment.
*
* @param string $request Request string
* @param string $location Location
@ -162,299 +201,183 @@ class SoapClient extends \SoapClient
*/
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
{
$soapResponse = $this->performSoapRequest(
$request,
$location,
$action,
$version,
$this->getSoapAttachmentsOnRequestFromStorage()
);
$this->setSoapResponseToStorage($soapResponse);
// wrap request data in SoapRequest object
$soapRequest = SoapRequest::create($request, $location, $action, $version);
return $soapResponse->getResponseContent();
}
// do actual SOAP request
$soapResponse = $this->__doRequest2($soapRequest);
/** @deprecated */
public function __getLastRequestHeaders()
{
$this->checkTracing();
throw new Exception(
'The __getLastRequestHeaders method is now deprecated. Use callSoapRequest instead and get the tracing information from SoapResponseTracingData.'
);
}
/** @deprecated */
public function __getLastRequest()
{
$this->checkTracing();
throw new Exception(
'The __getLastRequest method is now deprecated. Use callSoapRequest instead and get the tracing information from SoapResponseTracingData.'
);
}
/** @deprecated */
public function __getLastResponseHeaders()
{
$this->checkTracing();
throw new Exception(
'The __getLastResponseHeaders method is now deprecated. Use callSoapRequest instead and get the tracing information from SoapResponseTracingData.'
);
}
/** @deprecated */
public function __getLastResponse()
{
$this->checkTracing();
throw new Exception(
'The __getLastResponse method is now deprecated. Use callSoapRequest instead and get the tracing information from SoapResponseTracingData.'
);
// return SOAP response to ext/soap
return $soapResponse->getContent();
}
/**
* Custom request method to be able to modify the SOAP messages.
* $oneWay parameter is not used at the moment.
* Runs the currently registered request filters on the request, performs
* the HTTP request and runs the response filters.
*
* @param mixed $request Request object
* @param string $location Location
* @param string $action SOAP action
* @param int $version SOAP version
* @param SoapAttachment[] $soapAttachments SOAP attachments array
* @param SoapRequest $soapRequest SOAP request object
*
* @return SoapResponse
*/
private function performSoapRequest($request, $location, $action, $version, array $soapAttachments = [])
protected function __doRequest2(SoapRequest $soapRequest)
{
$soapRequest = $this->createSoapRequest($location, $action, $version, $request, $soapAttachments);
// run SoapKernel on SoapRequest
$this->soapKernel->filterRequest($soapRequest);
return $this->performHttpSoapRequest($soapRequest);
}
// perform HTTP request with cURL
$soapResponse = $this->__doHttpRequest($soapRequest);
/**
* @param string $location Location
* @param string $action SOAP action
* @param int $version SOAP version
* @param string $request SOAP request body
* @param SoapAttachment[] $soapAttachments array of SOAP attachments
*
* @return SoapRequest
*/
private function createSoapRequest($location, $action, $version, $request, array $soapAttachments = [])
{
$soapAttachmentList = new SoapAttachmentList($soapAttachments);
$soapRequest = SoapRequestFactory::create($location, $action, $version, $request);
if (count($soapAttachments) > 0) {
if ($this->soapOptions->hasAttachments() === true) {
$soapRequest->setAttachments(PartFactory::createAttachmentParts($soapAttachments));
$soapRequest = SoapKernel::filterRequest(
$soapRequest,
$this->getAttachmentFilters(),
$this->soapOptions->getAttachmentType()
);
} else {
throw new Exception(
'Non SWA SoapClient cannot handle SOAP action '.$action.' with attachments: '.implode(', ', $soapAttachmentList->getSoapAttachmentIds())
);
}
}
return $soapRequest;
}
/**
* Perform HTTP request with cURL.
*
* @param SoapRequest $soapRequest SoapRequest object
* @return SoapResponse
* @throws SoapFault
*/
private function performHttpSoapRequest(SoapRequest $soapRequest)
{
if ($soapRequest->getVersion() === SOAP_1_1) {
$headers = [
'Content-Type: ' . $soapRequest->getContentType(),
'SOAPAction: "' . $soapRequest->getAction() . '"',
'Connection: ' . ($this->soapOptions->isConnectionKeepAlive() ? 'Keep-Alive' : 'close'),
];
} else {
$headers = [
'Content-Type: ' . $soapRequest->getContentType() . '; action="' . $soapRequest->getAction() . '"',
'Connection: ' . ($this->soapOptions->isConnectionKeepAlive() ? 'Keep-Alive' : 'close'),
];
}
$curlResponse = $this->curl->executeCurlWithCachedSession(
$soapRequest->getLocation(),
$soapRequest->getContent(),
$headers
);
$soapResponseTracingData = new SoapResponseTracingData(
$curlResponse->getHttpRequestHeaders(),
$soapRequest->getContent(),
$curlResponse->getResponseHeader(),
$curlResponse->getResponseBody()
);
if ($curlResponse->curlStatusSuccess()) {
$soapResponse = $this->returnSoapResponseByTracing(
$soapRequest,
$curlResponse,
$soapResponseTracingData
);
if ($this->soapOptions->hasAttachments()) {
return SoapKernel::filterResponse(
$soapResponse,
$this->getAttachmentFilters(),
$this->soapOptions->getAttachmentType()
);
} else {
return $soapResponse;
}
} else if ($curlResponse->curlStatusFailed()) {
return $this->throwSoapFaultByTracing(
SoapFaultPrefixEnum::PREFIX_DEFAULT.'-'.SoapFaultEnum::SOAP_FAULT_HTTP.'-'.$curlResponse->getHttpResponseStatusCode(),
$curlResponse->getCurlErrorMessage(),
$soapResponseTracingData
);
} else {
return $this->throwSoapFaultByTracing(
SoapFaultPrefixEnum::PREFIX_DEFAULT.'-'.SoapFaultEnum::SOAP_FAULT_SOAP_CLIENT_ERROR,
'Cannot process curl response with unresolved status: ' . $curlResponse->getCurlStatus(),
$soapResponseTracingData
);
}
}
/**
* @param Curl $curl
* @param string $wsdlPath
* @param int $wsdlCacheType
* @param bool $resolveRemoteIncludes
*
* @return string
*/
private function loadWsdl(Curl $curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes = true)
{
$wsdlDownloader = new WsdlDownloader();
try {
$loadedWsdlFilePath = $wsdlDownloader->getWsdlPath($curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes);
} catch (Exception $e) {
throw new SoapFault(
SoapFaultEnum::SOAP_FAULT_WSDL,
'Unable to load WsdlPath ('.$wsdlPath.') with message: '.$e->getMessage().' in file: '.$e->getFile().' (line: '.$e->getLine().')'
);
}
return $loadedWsdlFilePath;
}
private function getAttachmentFilters()
{
$filters = [];
if ($this->soapOptions->getAttachmentType() !== SoapOptions::SOAP_ATTACHMENTS_TYPE_BASE64) {
$filters[] = new MimeFilter();
}
if ($this->soapOptions->getAttachmentType() === SoapOptions::SOAP_ATTACHMENTS_TYPE_MTOM) {
$filters[] = new XmlMimeFilter();
}
return $filters;
}
private function returnSoapResponseByTracing(
SoapRequest $soapRequest,
CurlResponse $curlResponse,
SoapResponseTracingData $soapResponseTracingData,
array $soapAttachments = []
) {
if ($this->soapClientOptions->getTrace() === true) {
return SoapResponseFactory::createWithTracingData(
$soapRequest,
$curlResponse->getResponseBody(),
$curlResponse->getHttpResponseContentType(),
$soapResponseTracingData,
$soapAttachments
);
} else {
return SoapResponseFactory::create(
$curlResponse->getResponseBody(),
$soapRequest->getLocation(),
$soapRequest->getAction(),
$soapRequest->getVersion(),
$curlResponse->getHttpResponseContentType(),
$soapAttachments
);
}
}
/**
* @param string $soapFaultCode
* @param string $soapFaultMessage
* @param SoapResponseTracingData $soapResponseTracingData
* @throws SoapFault
*/
private function throwSoapFaultByTracing($soapFaultCode, $soapFaultMessage, SoapResponseTracingData $soapResponseTracingData)
{
if ($this->soapClientOptions->getTrace() === true) {
throw new SoapFaultWithTracingData(
$soapFaultCode,
$soapFaultMessage,
$soapResponseTracingData
);
} else {
throw new SoapFault(
$soapFaultCode,
$soapFaultMessage
);
}
}
private function checkTracing()
{
if ($this->soapClientOptions->getTrace() === false) {
throw new Exception('SoapClientOptions tracing disabled, turn on trace attribute');
}
}
private function setSoapResponseToStorage(SoapResponse $soapResponseStorage)
{
$this->soapResponseStorage = $soapResponseStorage;
}
/**
* @param SoapAttachment[] $soapAttachments
*/
private function setSoapAttachmentsOnRequestToStorage(array $soapAttachments)
{
$this->soapAttachmentsOnRequestStorage = $soapAttachments;
}
private function getSoapAttachmentsOnRequestFromStorage()
{
$soapAttachmentsOnRequest = $this->soapAttachmentsOnRequestStorage;
$this->soapAttachmentsOnRequestStorage = null;
return $soapAttachmentsOnRequest;
}
private function getSoapResponseFromStorage()
{
$soapResponse = $this->soapResponseStorage;
$this->soapResponseStorage = null;
// run SoapKernel on SoapResponse
$this->soapKernel->filterResponse($soapResponse);
return $soapResponse;
}
/**
* Filters HTTP headers which will be sent
*
* @param SoapRequest $soapRequest SOAP request object
* @param array $headers An array of HTTP headers
*
* @return array
*/
protected function filterRequestHeaders(SoapRequest $soapRequest, array $headers)
{
return $headers;
}
/**
* Adds additional cURL options for the request
*
* @param SoapRequest $soapRequest SOAP request object
*
* @return array
*/
protected function filterRequestOptions(SoapRequest $soapRequest)
{
return array();
}
/**
* Get last request HTTP headers.
*
* @return string
*/
public function __getLastRequestHeaders()
{
return $this->lastRequestHeaders;
}
/**
* Get last request HTTP body.
*
* @return string
*/
public function __getLastRequest()
{
return $this->lastRequest;
}
/**
* Get last response HTTP headers.
*
* @return string
*/
public function __getLastResponseHeaders()
{
return $this->lastResponseHeaders;
}
/**
* Get last response HTTP body.
*
* @return string
*/
public function __getLastResponse()
{
return $this->lastResponse;
}
/**
* Get SoapKernel instance.
*
* @return \BeSimple\SoapClient\SoapKernel
*/
public function getSoapKernel()
{
return $this->soapKernel;
}
/**
* Configure filter and type converter for SwA/MTOM.
*
* @param array &$options SOAP constructor options array.
*
* @return void
*/
private function configureMime(array &$options)
{
if (isset($options['attachment_type']) && Helper::ATTACHMENTS_TYPE_BASE64 !== $options['attachment_type']) {
// register mime filter in SoapKernel
$mimeFilter = new MimeFilter($options['attachment_type']);
$this->soapKernel->registerFilter($mimeFilter);
// configure type converter
if (Helper::ATTACHMENTS_TYPE_SWA === $options['attachment_type']) {
$converter = new SwaTypeConverter();
$converter->setKernel($this->soapKernel);
} elseif (Helper::ATTACHMENTS_TYPE_MTOM === $options['attachment_type']) {
$xmlMimeFilter = new XmlMimeFilter($options['attachment_type']);
$this->soapKernel->registerFilter($xmlMimeFilter);
$converter = new MtomTypeConverter();
$converter->setKernel($this->soapKernel);
}
// configure typemap
if (!isset($options['typemap'])) {
$options['typemap'] = array();
}
$options['typemap'][] = array(
'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input);
},
'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input);
},
);
}
}
/**
* Downloads WSDL files with cURL. Uses all SoapClient options for
* authentication. Uses the WSDL_CACHE_* constants and the 'soap.wsdl_*'
* ini settings. Does only file caching as SoapClient only supports a file
* name parameter.
*
* @param string $wsdl WSDL file
* @param array(string=>mixed) $options Options array
*
* @return string
*/
protected function loadWsdl($wsdl, array $options)
{
// option to resolve wsdl/xsd includes
$resolveRemoteIncludes = true;
if (isset($options['resolve_wsdl_remote_includes'])) {
$resolveRemoteIncludes = $options['resolve_wsdl_remote_includes'];
}
// option to enable cache
$wsdlCache = WSDL_CACHE_DISK;
if (isset($options['cache_wsdl'])) {
$wsdlCache = $options['cache_wsdl'];
}
$wsdlDownloader = new WsdlDownloader($this->curl, $resolveRemoteIncludes, $wsdlCache);
try {
$cacheFileName = $wsdlDownloader->download($wsdl);
} catch (\RuntimeException $e) {
throw new \SoapFault('WSDL', "SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl . "' : failed to load external entity \"" . $wsdl . "\"");
}
return $cacheFileName;
}
}

View File

@ -12,44 +12,237 @@
namespace BeSimple\SoapClient;
use BeSimple\SoapBundle\Cache;
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use Exception;
use SoapHeader;
use BeSimple\SoapCommon\AbstractSoapBuilder;
use BeSimple\SoapCommon\Helper;
/**
* Provides a SoapClient instance.
* Fluent interface builder for SoapClient instance.
*
* @author Francis Besset <francis.besset@gmail.com>
* @author Christian Kerl <christian-kerl@web.de>
* @author Petr Bechyně <mail@petrbechyne.com>
*/
class SoapClientBuilder
class SoapClientBuilder extends AbstractSoapBuilder
{
public function build(SoapClientOptions $soapClientOptions, SoapOptions $soapOptions)
{
$cache = new Cache($soapOptions);
$cache->validateSettings($soapOptions);
/**
* Authentication options.
*
* @var array(string=>mixed)
*/
protected $soapOptionAuthentication = array();
return new SoapClient(
$soapClientOptions,
$soapOptions
);
/**
* Create new instance with default options.
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public static function createWithDefaults()
{
return parent::createWithDefaults()
->withUserAgent('BeSimpleSoap');
}
public function buildWithSoapHeader(
SoapClientOptions $soapClientOptions,
SoapOptions $soapOptions,
SoapHeader $soapHeader
) {
$soapClient = $this->build($soapClientOptions, $soapOptions);
if ($soapClient->__setSoapHeaders($soapHeader) === false) {
throw new Exception(
'Could not set SoapHeader: '.var_export($soapHeader, true)
);
/**
* Finally returns a SoapClient instance.
*
* @return \BeSimple\SoapClient\SoapClient
*/
public function build()
{
$this->validateOptions();
return new SoapClient($this->wsdl, $this->getSoapOptions());
}
/**
* Get final array of SOAP options.
*
* @return array(string=>mixed)
*/
public function getSoapOptions()
{
return parent::getSoapOptions() + $this->soapOptionAuthentication;
}
/**
* Configure option 'trace'.
*
* @param boolean $trace Enable/Disable
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withTrace($trace = true)
{
$this->soapOptions['trace'] = $trace;
return $this;
}
/**
* Configure option 'exceptions'.
*
* @param boolean $exceptions Enable/Disable
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withExceptions($exceptions = true)
{
$this->soapOptions['exceptions'] = $exceptions;
return $this;
}
/**
* Configure option 'user_agent'.
*
* @param string $userAgent User agent string
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withUserAgent($userAgent)
{
$this->soapOptions['user_agent'] = $userAgent;
return $this;
}
/**
* Enable gzip compression.
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withCompressionGzip()
{
$this->soapOptions['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
return $this;
}
/**
* Enable deflate compression.
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withCompressionDeflate()
{
$this->soapOptions['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE;
return $this;
}
/**
* Configure basic authentication
*
* @param string $username Username
* @param string $password Password
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withBasicAuthentication($username, $password)
{
$this->soapOptionAuthentication = array(
'authentication' => SOAP_AUTHENTICATION_BASIC,
'login' => $username,
'password' => $password,
);
return $this;
}
/**
* Configure digest authentication.
*
* @param string $certificate Certificate
* @param string $passphrase Passphrase
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withDigestAuthentication($certificate, $passphrase = null)
{
$this->soapOptionAuthentication = array(
'authentication' => SOAP_AUTHENTICATION_DIGEST,
'local_cert' => $certificate,
);
if ($passphrase) {
$this->soapOptionAuthentication['passphrase'] = $passphrase;
}
return $soapClient;
return $this;
}
/**
* Configure proxy.
*
* @param string $host Host
* @param int $port Port
* @param string $login Login
* @param string $password Password
* @param int $auth Authentication method
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withProxy($host, $port, $login = null, $password = null, $auth = null)
{
$this->soapOptions['proxy_host'] = $host;
$this->soapOptions['proxy_port'] = $port;
if ($login) {
$this->soapOptions['proxy_login'] = $login;
$this->soapOptions['proxy_password'] = $password;
if ($auth) {
if (!in_array($auth, array(\CURLAUTH_BASIC, \CURLAUTH_NTLM), true)) {
throw new \InvalidArgumentException('Invalid authentication method: CURLAUTH_BASIC or CURLAUTH_NTLM constants are availables.');
}
$this->soapOptions['proxy_auth'] = $auth;
}
}
return $this;
}
/**
* SOAP attachment type Base64.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withBase64Attachments()
{
$this->options['attachment_type'] = Helper::ATTACHMENTS_TYPE_BASE64;
return $this;
}
/**
* SOAP attachment type SwA.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withSwaAttachments()
{
$this->options['attachment_type'] = Helper::ATTACHMENTS_TYPE_SWA;
return $this;
}
/**
* SOAP attachment type MTOM.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withMtomAttachments()
{
$this->options['attachment_type'] = Helper::ATTACHMENTS_TYPE_MTOM;
return $this;
}
/**
* Validate options.
*/
protected function validateOptions()
{
$this->validateWsdl();
}
}

View File

@ -1,7 +0,0 @@
<?php
namespace BeSimple\SoapClient;
class SoapClientMessageWithAttachments
{
}

View File

@ -1,84 +0,0 @@
<?php
/*
* This file is part of the BeSimpleSoapBundle.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient;
use BeSimple\SoapClient\Curl\CurlOptions;
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
use BeSimple\SoapClient\SoapServerAuthentication\SoapServerAuthenticationInterface;
/**
* Provides a SoapClient instance.
*
* @author Francis Besset <francis.besset@gmail.com>
* @author Christian Kerl <christian-kerl@web.de>
* @author Petr Bechyně <mail@petrbechyne.com>
*/
class SoapClientOptionsBuilder
{
public static function createWithDefaults()
{
return new SoapClientOptions(
SoapClientOptions::SOAP_CLIENT_TRACE_OFF,
SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_ON,
CurlOptions::DEFAULT_USER_AGENT,
SoapClientOptions::SOAP_CLIENT_COMPRESSION_NONE
);
}
public static function createWithTracing()
{
return new SoapClientOptions(
SoapClientOptions::SOAP_CLIENT_TRACE_ON,
SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_ON,
CurlOptions::DEFAULT_USER_AGENT,
SoapClientOptions::SOAP_CLIENT_COMPRESSION_NONE
);
}
public static function createWithEndpointLocation($endpointLocation)
{
return new SoapClientOptions(
SoapClientOptions::SOAP_CLIENT_TRACE_ON,
SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_ON,
CurlOptions::DEFAULT_USER_AGENT,
SoapClientOptions::SOAP_CLIENT_COMPRESSION_NONE,
SoapClientOptions::SOAP_CLIENT_AUTHENTICATION_NONE,
SoapClientOptions::SOAP_CLIENT_PROXY_NONE,
$endpointLocation
);
}
public static function createWithAuthentication(SoapServerAuthenticationInterface $authentication)
{
return new SoapClientOptions(
SoapClientOptions::SOAP_CLIENT_TRACE_ON,
SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_ON,
CurlOptions::DEFAULT_USER_AGENT,
SoapClientOptions::SOAP_CLIENT_COMPRESSION_NONE,
$authentication
);
}
public static function createWithAuthenticationAndEndpointLocation($endpointLocation, SoapServerAuthenticationInterface $authentication)
{
return new SoapClientOptions(
SoapClientOptions::SOAP_CLIENT_TRACE_ON,
SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_ON,
CurlOptions::DEFAULT_USER_AGENT,
SoapClientOptions::SOAP_CLIENT_COMPRESSION_NONE,
$authentication,
SoapClientOptions::SOAP_CLIENT_PROXY_NONE,
$endpointLocation
);
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace BeSimple\SoapClient;
use SoapFault;
class SoapFaultWithTracingData extends SoapFault
{
private $soapResponseTracingData;
public function __construct($code = 0, $message = "", SoapResponseTracingData $soapResponseTracingData)
{
$this->soapResponseTracingData = $soapResponseTracingData;
parent::__construct($code, $message);
}
public function getSoapResponseTracingData()
{
return $this->soapResponseTracingData;
}
}

View File

@ -0,0 +1,47 @@
<?php
/*
* This file is part of the BeSimpleSoapCommon.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
* (c) Andreas Schamberger <mail@andreass.net>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient;
use BeSimple\SoapCommon\SoapKernel as CommonSoapKernel;
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
/**
* SoapKernel for Client.
*
* @author Andreas Schamberger <mail@andreass.net>
*/
class SoapKernel extends CommonSoapKernel
{
/**
* {@inheritDoc}
*/
public function filterRequest(CommonSoapRequest $request)
{
$request->setAttachments($this->attachments);
$this->attachments = array();
parent::filterRequest($request);
}
/**
* {@inheritDoc}
*/
public function filterResponse(CommonSoapResponse $response)
{
parent::filterResponse($response);
$this->attachments = $response->getAttachments();
}
}

View File

@ -1,145 +0,0 @@
<?php
namespace BeSimple\SoapClient\SoapOptions;
use BeSimple\SoapClient\Curl\CurlOptions;
use BeSimple\SoapClient\SoapServerAuthentication\SoapServerAuthenticationBasic;
use BeSimple\SoapClient\SoapServerAuthentication\SoapServerAuthenticationDigest;
use BeSimple\SoapClient\SoapServerAuthentication\SoapServerAuthenticationInterface;
use BeSimple\SoapClient\SoapServerProxy\SoapServerProxy;
class SoapClientOptions
{
const SOAP_CLIENT_TRACE_ON = true;
const SOAP_CLIENT_TRACE_OFF = false;
const SOAP_CLIENT_EXCEPTIONS_ON = true;
const SOAP_CLIENT_EXCEPTIONS_OFF = false;
const SOAP_CLIENT_COMPRESSION_NONE = CurlOptions::SOAP_COMPRESSION_NONE;
const SOAP_CLIENT_COMPRESSION_GZIP = CurlOptions::SOAP_COMPRESSION_GZIP;
const SOAP_CLIENT_COMPRESSION_DEFLATE = CurlOptions::SOAP_COMPRESSION_DEFLATE;
const SOAP_CLIENT_AUTHENTICATION_NONE = null;
const SOAP_CLIENT_PROXY_NONE = null;
private $trace;
private $exceptions;
private $userAgent;
private $compression;
private $authentication;
private $proxy;
private $location;
/**
* @param bool $trace = SoapClientOptions::SOAP_CLIENT_TRACE_ON|SoapClientOptions::SOAP_CLIENT_TRACE_OFF
* @param bool $exceptions = SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_ON|SoapClientOptions::SOAP_CLIENT_EXCEPTIONS_OFF
* @param string $userAgent
* @param int|null $compression = SoapClientOptions::SOAP_CLIENT_COMPRESSION_NONE|SoapClientOptions::SOAP_CLIENT_COMPRESSION_GZIP|SoapClientOptions::SOAP_CLIENT_COMPRESSION_DEFLATE
* @param SoapServerAuthenticationInterface|null $authentication
* @param SoapServerProxy|null $proxy
* @param string|null $location
*/
public function __construct(
$trace,
$exceptions,
$userAgent,
$compression = null,
SoapServerAuthenticationInterface $authentication = null,
SoapServerProxy $proxy = null,
$location = null
) {
$this->trace = $trace;
$this->exceptions = $exceptions;
$this->userAgent = $userAgent;
$this->compression = $compression;
$this->authentication = $authentication;
$this->proxy = $proxy;
$this->location = $location;
}
public function getTrace()
{
return $this->trace;
}
public function getExceptions()
{
return $this->exceptions;
}
public function getUserAgent()
{
return $this->userAgent;
}
public function hasCompression()
{
return $this->compression !== self::SOAP_CLIENT_COMPRESSION_NONE;
}
public function getCompression()
{
return $this->compression;
}
public function hasAuthentication()
{
return $this->authentication !== null;
}
public function hasAuthenticationBasic()
{
return $this->hasAuthentication() && $this->getAuthentication() instanceof SoapServerAuthenticationBasic;
}
public function hasAuthenticationDigest()
{
return $this->hasAuthentication() && $this->getAuthentication() instanceof SoapServerAuthenticationDigest;
}
public function hasProxy()
{
return $this->proxy !== null;
}
public function hasLocation()
{
return $this->location !== null;
}
public function getAuthentication()
{
return $this->authentication;
}
public function getProxy()
{
return $this->proxy;
}
public function getLocation()
{
return $this->location;
}
public function toArray()
{
$optionsAsArray = [
'trace' => $this->getTrace(),
'exceptions' => $this->getExceptions(),
'user_agent' => $this->getUserAgent(),
];
if ($this->hasCompression()) {
$optionsAsArray['compression'] = $this->getCompression();
}
if ($this->hasAuthentication()) {
$optionsAsArray += $this->getAuthentication()->toArray();
}
if ($this->hasProxy()) {
$optionsAsArray += $this->getProxy()->toArray();
}
if ($this->hasLocation()) {
$optionsAsArray['location'] = $this->getLocation();
}
return $optionsAsArray;
}
}

View File

@ -0,0 +1,48 @@
<?php
/*
* This file is part of the BeSimpleSoapClient.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient;
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
use BeSimple\SoapCommon\SoapMessage;
/**
* SoapRequest class for SoapClient. Provides factory function for request object.
*
* @author Andreas Schamberger <mail@andreass.net>
*/
class SoapRequest extends CommonSoapRequest
{
/**
* Factory function for SoapRequest.
*
* @param string $content Content
* @param string $location Location
* @param string $action SOAP action
* @param string $version SOAP version
*
* @return BeSimple\SoapClient\SoapRequest
*/
public static function create($content, $location, $action, $version)
{
$request = new SoapRequest();
// $content is if unmodified from SoapClient not a php string type!
$request->setContent((string) $content);
$request->setLocation($location);
$request->setAction($action);
$request->setVersion($version);
$contentType = SoapMessage::getContentTypeForVersion($version);
$request->setContentType($contentType);
return $request;
}
}

View File

@ -1,56 +1,46 @@
<?php
/*
* This file is part of the BeSimpleSoapClient.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient;
use BeSimple\SoapCommon\SoapRequest;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
/**
* SoapResponse class for SoapClient. Provides factory function for response object.
*
* @author Andreas Schamberger <mail@andreass.net>
*/
class SoapResponse extends CommonSoapResponse
{
/** @var mixed */
protected $responseObject;
/** @var SoapResponseTracingData */
protected $tracingData;
/** @var SoapRequest */
protected $request;
public function getResponseContent()
/**
* Factory function for SoapResponse.
*
* @param string $content Content
* @param string $location Location
* @param string $action SOAP action
* @param string $version SOAP version
* @param string $contentType Content type header
*
* @return BeSimple\SoapClient\SoapResponse
*/
public static function create($content, $location, $action, $version, $contentType)
{
return $this->getContent();
}
$response = new SoapResponse();
$response->setContent($content);
$response->setLocation($location);
$response->setAction($action);
$response->setVersion($version);
$response->setContentType($contentType);
public function getResponseObject()
{
return $this->responseObject;
}
public function setResponseObject($responseObject)
{
$this->responseObject = $responseObject;
}
public function hasTracingData()
{
return $this->tracingData !== null;
}
public function getTracingData()
{
return $this->tracingData;
}
public function setTracingData(SoapResponseTracingData $tracingData)
{
$this->tracingData = $tracingData;
}
public function setRequest(SoapRequest $request)
{
$this->request = $request;
}
public function getRequest()
{
return $this->request;
return $response;
}
}

View File

@ -1,96 +0,0 @@
<?php
/*
* This file is part of the BeSimpleSoapClient.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient;
use BeSimple\SoapBundle\Soap\SoapAttachment;
use BeSimple\SoapCommon\Mime\PartFactory;
use BeSimple\SoapCommon\SoapRequest;
/**
* SoapResponseFactory for SoapClient. Provides factory function for SoapResponse object.
*
* @author Andreas Schamberger <mail@andreass.net>
* @author Petr Bechyně <mail@petrbechyne.com>
*/
class SoapResponseFactory
{
/**
* Factory method for SoapClient\SoapResponse.
*
* @param string $content Content
* @param string $location Location
* @param string $action SOAP action
* @param string $version SOAP version
* @param string $contentType Content type header
* @param SoapAttachment[] $attachments SOAP attachments
* @return SoapResponse
*/
public static function create(
$content,
$location,
$action,
$version,
$contentType,
array $attachments = []
) {
$response = new SoapResponse();
$response->setContent($content);
$response->setLocation($location);
$response->setAction($action);
$response->setVersion($version);
$response->setContentType($contentType);
if (count($attachments) > 0) {
$response->setAttachments(
PartFactory::createAttachmentParts($attachments)
);
}
return $response;
}
/**
* Factory method for SoapClient\SoapResponse with SoapResponseTracingData.
*
* @param SoapRequest $soapRequest related request object
* @param string $content Content
* @param string $contentType Content type header
* @param SoapResponseTracingData $tracingData Data value object suitable for tracing SOAP traffic
* @param SoapAttachment[] $attachments SOAP attachments
* @return SoapResponse
*/
public static function createWithTracingData(
SoapRequest $soapRequest,
$content,
$contentType,
SoapResponseTracingData $tracingData,
array $attachments = []
) {
$response = new SoapResponse();
$response->setRequest($soapRequest);
$response->setContent($content);
$response->setLocation($soapRequest->getLocation());
$response->setAction($soapRequest->getAction());
$response->setVersion($soapRequest->getVersion());
$response->setContentType($contentType);
if ($tracingData !== null) {
$response->setTracingData($tracingData);
}
if (count($attachments) > 0) {
$response->setAttachments(
PartFactory::createAttachmentParts($attachments)
);
}
return $response;
}
}

View File

@ -1,39 +0,0 @@
<?php
namespace BeSimple\SoapClient;
class SoapResponseTracingData
{
private $lastRequestHeaders;
private $lastRequest;
private $lastResponseHeaders;
private $lastResponse;
public function __construct($lastRequestHeaders, $lastRequest, $lastResponseHeaders, $lastResponse)
{
$this->lastRequestHeaders = $lastRequestHeaders;
$this->lastRequest = $lastRequest;
$this->lastResponseHeaders = $lastResponseHeaders;
$this->lastResponse = $lastResponse;
}
public function getLastRequestHeaders()
{
return $this->lastRequestHeaders;
}
public function getLastRequest()
{
return $this->lastRequest;
}
public function getLastResponseHeaders()
{
return $this->lastResponseHeaders;
}
public function getLastResponse()
{
return $this->lastResponse;
}
}

View File

@ -1,39 +0,0 @@
<?php
namespace BeSimple\SoapClient\SoapServerAuthentication;
class SoapServerAuthenticationBasic implements SoapServerAuthenticationInterface
{
private $login;
private $password;
public function __construct($login, $password)
{
$this->login = $login;
$this->password = $password;
}
public function getAuthentication()
{
return \SOAP_AUTHENTICATION_BASIC;
}
public function getLogin()
{
return $this->login;
}
public function getPassword()
{
return $this->password;
}
public function toArray()
{
return [
'authentication' => $this->getAuthentication(),
'login' => $this->getLogin(),
'password' => $this->getPassword(),
];
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace BeSimple\SoapClient\SoapServerAuthentication;
class SoapServerAuthenticationDigest implements SoapServerAuthenticationInterface
{
private $localCert;
private $passPhrase;
/**
* @param string $localCert
* @param string $passPhrase = null
*/
public function __construct($localCert, $passPhrase = null)
{
$this->localCert = $localCert;
$this->passPhrase = $passPhrase;
}
public function getLocalCert()
{
return $this->localCert;
}
public function hasPassPhrase()
{
return $this->passPhrase !== null;
}
public function getPassPhrase()
{
return $this->passPhrase;
}
public function getAuthentication()
{
return \SOAP_AUTHENTICATION_DIGEST;
}
public function toArray()
{
$authenticationAsArray = [
'authentication' => $this->getAuthentication(),
'local_cert' => $this->getLocalCert()
];
if ($this->hasPassPhrase()) {
$authenticationAsArray['passphrase'] = $this->getPassPhrase();
}
return $authenticationAsArray;
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace BeSimple\SoapClient\SoapServerAuthentication;
interface SoapServerAuthenticationInterface
{
/**
* @return int
*/
public function getAuthentication();
/**
* @return array
*/
public function toArray();
}

View File

@ -1,84 +0,0 @@
<?php
namespace BeSimple\SoapClient\SoapServerProxy;
class SoapServerProxy
{
const PROXY_AUTHENTICATION_TYPE_NONE = null;
const PROXY_AUTHENTICATION_TYPE_BASIC = \CURLAUTH_BASIC;
const PROXY_AUTHENTICATION_TYPE_NTLM = \CURLAUTH_NTLM;
private $host;
private $port;
private $login;
private $password;
private $authenticationType;
/**
* @param string $host
* @param int $port
* @param string $login = null
* @param string $password = null
* @param int $authenticationType = null|SoapServerProxy::PROXY_AUTHENTICATION_TYPE_BASIC|SoapServerProxy::PROXY_AUTHENTICATION_TYPE_NTLM
*/
public function __construct($host, $port, $login = null, $password = null, $authenticationType = null)
{
$this->host = $host;
$this->port = $port;
$this->login = $login;
$this->password = $password;
$this->authenticationType = $authenticationType;
}
public function getHost()
{
return $this->host;
}
public function getPort()
{
return $this->port;
}
public function hasCredentials()
{
return $this->login !== null;
}
public function getLogin()
{
return $this->login;
}
public function getPassword()
{
return $this->password;
}
public function hasAuthenticationType()
{
return $this->authenticationType !== self::PROXY_AUTHENTICATION_TYPE_NONE;
}
public function getAuthenticationType()
{
return $this->authenticationType;
}
public function toArray()
{
$proxyAsArray = [
'proxy_host' => $this->getHost(),
'proxy_port' => $this->getPort(),
];
if ($this->hasCredentials()) {
$proxyAsArray['proxy_login'] = $this->getLogin();
$proxyAsArray['proxy_password'] = $this->getPassword();
}
if ($this->hasAuthenticationType()) {
$proxyAsArray['proxy_auth'] = $this->getAuthenticationType();
}
return $proxyAsArray;
}
}

View File

@ -0,0 +1,53 @@
<?php
/*
* This file is part of the BeSimpleSoapClient.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapClient\Tests;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\ProcessBuilder;
/**
* @author francis.besset@gmail.com <francis.besset@gmail.com>
*/
abstract class AbstractWebServerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ProcessBuilder
*/
protected static $webserver;
public static function setUpBeforeClass()
{
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
self::markTestSkipped('PHP Webserver is available from PHP 5.4');
}
$phpFinder = new PhpExecutableFinder();
self::$webserver = ProcessBuilder::create(array(
'exec', // used exec binary (https://github.com/symfony/symfony/issues/5759)
$phpFinder->find(),
'-S',
sprintf('localhost:%d', WEBSERVER_PORT),
'-t',
__DIR__.DIRECTORY_SEPARATOR.'Fixtures',
))->getProcess();
self::$webserver->start();
usleep(100000);
}
public static function tearDownAfterClass()
{
self::$webserver->stop(0);
usleep(100000);
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class AttachmentRequest extends AttachmentType
{
}

View File

@ -0,0 +1,9 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class AttachmentType
{
public $fileName;
public $binaryData;
}

View File

@ -0,0 +1,11 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class BookInformation
{
public $type;
public $isbn;
public $author;
public $title;
}

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://ws.apache.org/axis2/mtomsample/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.apache.org/axis2/mtomsample/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
<types>
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws.apache.org/axis2/mtomsample/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<xsd:import namespace="http://www.w3.org/2005/05/xmlmime"/>
<xsd:complexType name="AttachmentType">
<xsd:sequence>
<xsd:element minOccurs="0" name="fileName" type="xsd:string"/>
<xsd:element minOccurs="0" name="binaryData" type="xmime:base64Binary"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="AttachmentRequest" type="tns:AttachmentType"/>
<xsd:element name="AttachmentResponse" type="xsd:string"/>
</xsd:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.w3.org/2005/05/xmlmime">
<xs:attribute name="contentType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="expectedContentTypes" type="xs:string"/>
<xs:complexType name="base64Binary">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute ref="xmime:contentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="hexBinary">
<xs:simpleContent>
<xs:extension base="xs:hexBinary">
<xs:attribute ref="xmime:contentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
</types>
<message name="AttachmentResponse">
<part name="part1" element="tns:AttachmentResponse">
</part>
</message>
<message name="AttachmentRequest">
<part name="part1" element="tns:AttachmentRequest">
</part>
</message>
<portType name="MTOMServicePortType">
<operation name="attachment">
<input message="tns:AttachmentRequest" wsaw:Action="attachment">
</input>
<output message="tns:AttachmentResponse" wsaw:Action="http://schemas.xmlsoap.org/wsdl/MTOMServicePortType/AttachmentResponse">
</output>
</operation>
</portType>
<binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="attachment">
<soap:operation soapAction="attachment" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<binding name="MTOMServiceSOAP12Binding" type="tns:MTOMServicePortType">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="attachment">
<soap12:operation soapAction="attachment" style="document"/>
<input>
<soap12:body use="literal"/>
</input>
<output>
<soap12:body use="literal"/>
</output>
</operation>
</binding>
<service name="MTOMSample">
<port name="MTOMSampleSOAP12port_http" binding="tns:MTOMServiceSOAP12Binding">
<soap12:address location="http://localhost:8080/axis2/services/MTOMSample.MTOMSampleSOAP12port_http/"/>
</port>
<port name="MTOMSampleSOAP11port_http" binding="tns:MTOMServiceSOAP11Binding">
<soap:address location="http://localhost:8080/axis2/services/MTOMSample.MTOMSampleSOAP11port_http/"/>
</port>
</service>
</definitions>

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://service.besimple" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://service.besimple">
<wsdl:documentation>BeSimpleSwaService</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.besimple">
<xs:complexType name="Exception">
<xs:sequence>
<xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Exception">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="Exception" nillable="true" type="ns:Exception"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uploadFile">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="data" nillable="true" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uploadFileResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="downloadFile">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="downloadFileResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="data" nillable="true" type="xs:base64Binary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="downloadFileRequest">
<wsdl:part name="parameters" element="ns:downloadFile"/>
</wsdl:message>
<wsdl:message name="downloadFileResponse">
<wsdl:part name="parameters" element="ns:downloadFileResponse"/>
</wsdl:message>
<wsdl:message name="Exception">
<wsdl:part name="parameters" element="ns:Exception"/>
</wsdl:message>
<wsdl:message name="uploadFileRequest">
<wsdl:part name="parameters" element="ns:uploadFile"/>
</wsdl:message>
<wsdl:message name="uploadFileResponse">
<wsdl:part name="parameters" element="ns:uploadFileResponse"/>
</wsdl:message>
<wsdl:portType name="BeSimpleSwaServicePortType">
<wsdl:operation name="downloadFile">
<wsdl:input message="ns:downloadFileRequest" wsaw:Action="urn:downloadFile"/>
<wsdl:output message="ns:downloadFileResponse" wsaw:Action="urn:downloadFileResponse"/>
<wsdl:fault message="ns:Exception" name="Exception" wsaw:Action="urn:downloadFileException"/>
</wsdl:operation>
<wsdl:operation name="uploadFile">
<wsdl:input message="ns:uploadFileRequest" wsaw:Action="urn:uploadFile"/>
<wsdl:output message="ns:uploadFileResponse" wsaw:Action="urn:uploadFileResponse"/>
<wsdl:fault message="ns:Exception" name="Exception" wsaw:Action="urn:uploadFileException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BeSimpleSwaServiceSoap11Binding" type="ns:BeSimpleSwaServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="downloadFile">
<soap:operation soapAction="urn:downloadFile" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="Exception">
<soap:fault use="literal" name="Exception"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="uploadFile">
<soap:operation soapAction="urn:uploadFile" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="Exception">
<soap:fault use="literal" name="Exception"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BeSimpleSwaServiceSoap12Binding" type="ns:BeSimpleSwaServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="downloadFile">
<soap12:operation soapAction="urn:downloadFile" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="Exception">
<soap12:fault use="literal" name="Exception"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="uploadFile">
<soap12:operation soapAction="urn:uploadFile" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="Exception">
<soap12:fault use="literal" name="Exception"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BeSimpleSwaServiceHttpBinding" type="ns:BeSimpleSwaServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="downloadFile">
<http:operation location="BeSimpleSwaService/downloadFile"/>
<wsdl:input>
<mime:content type="text/xml" part="downloadFile"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="downloadFile"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="uploadFile">
<http:operation location="BeSimpleSwaService/uploadFile"/>
<wsdl:input>
<mime:content type="text/xml" part="uploadFile"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="uploadFile"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="BeSimpleSwaService">
<wsdl:port name="BeSimpleSwaServiceHttpSoap11Endpoint" binding="ns:BeSimpleSwaServiceSoap11Binding">
<soap:address location="http://localhost:8080/axis2/services/BeSimpleSwaService.BeSimpleSwaServiceHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="BeSimpleSwaServiceHttpSoap12Endpoint" binding="ns:BeSimpleSwaServiceSoap12Binding">
<soap12:address location="http://localhost:8080/axis2/services/BeSimpleSwaService.BeSimpleSwaServiceHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="BeSimpleSwaServiceHttpEndpoint" binding="ns:BeSimpleSwaServiceHttpBinding">
<http:address location="http://localhost:8080/axis2/services/BeSimpleSwaService.BeSimpleSwaServiceHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws.sosnoski.com/library/wsdl"
xmlns:wns="http://ws.sosnoski.com/library/wsdl"
xmlns:tns="http://ws.sosnoski.com/library/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://ws.sosnoski.com/library/wsdl"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws.sosnoski.com/library/types"/>
<element name="getBook">
<complexType>
<sequence>
<element name="isbn" type="string"/>
</sequence>
</complexType>
</element>
<element name="getBookResponse">
<complexType>
<sequence>
<element name="getBookReturn" minOccurs="0" type="tns:BookInformation"/>
</sequence>
</complexType>
</element>
<element name="getBooksByType">
<complexType>
<sequence>
<element name="type" type="string"/>
</sequence>
</complexType>
</element>
<element name="getBooksByTypeResponse">
<complexType>
<sequence>
<element name="getBooksByTypeReturn" minOccurs="0" maxOccurs="unbounded" type="tns:BookInformation"/>
</sequence>
</complexType>
</element>
<element name="addBook">
<complexType>
<sequence>
<element name="type" type="string"/>
<element name="isbn" type="string"/>
<element name="author" minOccurs="0" maxOccurs="unbounded" type="string"/>
<element name="title" type="string"/>
</sequence>
</complexType>
</element>
<element name="addBookResponse">
<complexType>
<sequence>
<element name="addBookReturn" type="boolean"/>
</sequence>
</complexType>
</element>
</schema>
<schema elementFormDefault="qualified"
targetNamespace="http://ws.sosnoski.com/library/types"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="BookInformation">
<sequence>
<element name="author" minOccurs="0" maxOccurs="unbounded" type="string"/>
<element name="title" type="string"/>
</sequence>
<attribute name="type" use="required" type="string"/>
<attribute name="isbn" use="required" type="string"/>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getBookRequest">
<wsdl:part element="wns:getBook" name="parameters"/>
</wsdl:message>
<wsdl:message name="getBookResponse">
<wsdl:part element="wns:getBookResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getBooksByTypeRequest">
<wsdl:part element="wns:getBooksByType" name="parameters"/>
</wsdl:message>
<wsdl:message name="getBooksByTypeResponse">
<wsdl:part element="wns:getBooksByTypeResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="addBookRequest">
<wsdl:part element="wns:addBook" name="parameters"/>
</wsdl:message>
<wsdl:message name="addBookResponse">
<wsdl:part element="wns:addBookResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Library">
<wsdl:operation name="getBook">
<wsdl:input message="wns:getBookRequest" name="getBookRequest"/>
<wsdl:output message="wns:getBookResponse" name="getBookResponse"/>
</wsdl:operation>
<wsdl:operation name="getBooksByType">
<wsdl:input message="wns:getBooksByTypeRequest" name="getBooksByTypeRequest"/>
<wsdl:output message="wns:getBooksByTypeResponse" name="getBooksByTypeResponse"/>
</wsdl:operation>
<wsdl:operation name="addBook">
<wsdl:input message="wns:addBookRequest" name="addBookRequest"/>
<wsdl:output message="wns:addBookResponse" name="addBookResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="LibrarySoapBinding" type="wns:Library">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getBook">
<wsdlsoap:operation soapAction="urn:getBook"/>
<wsdl:input name="getBookRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getBookResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getBooksByType">
<wsdlsoap:operation soapAction="urn:getBooksByType"/>
<wsdl:input name="getBooksByTypeRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getBooksByTypeResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addBook">
<wsdlsoap:operation soapAction="urn:addBook"/>
<wsdl:input name="addBookRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addBookResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="library-signencr">
<wsdl:port binding="wns:LibrarySoapBinding" name="library">
<wsdlsoap:address location="http://localhost:8080/axis2/services/library-signencr"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws.sosnoski.com/library/wsdl"
xmlns:wns="http://ws.sosnoski.com/library/wsdl"
xmlns:tns="http://ws.sosnoski.com/library/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://ws.sosnoski.com/library/wsdl"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws.sosnoski.com/library/types"/>
<element name="getBook">
<complexType>
<sequence>
<element name="isbn" type="string"/>
</sequence>
</complexType>
</element>
<element name="getBookResponse">
<complexType>
<sequence>
<element name="getBookReturn" minOccurs="0" type="tns:BookInformation"/>
</sequence>
</complexType>
</element>
<element name="getBooksByType">
<complexType>
<sequence>
<element name="type" type="string"/>
</sequence>
</complexType>
</element>
<element name="getBooksByTypeResponse">
<complexType>
<sequence>
<element name="getBooksByTypeReturn" minOccurs="0" maxOccurs="unbounded" type="tns:BookInformation"/>
</sequence>
</complexType>
</element>
<element name="addBook">
<complexType>
<sequence>
<element name="type" type="string"/>
<element name="isbn" type="string"/>
<element name="author" minOccurs="0" maxOccurs="unbounded" type="string"/>
<element name="title" type="string"/>
</sequence>
</complexType>
</element>
<element name="addBookResponse">
<complexType>
<sequence>
<element name="addBookReturn" type="boolean"/>
</sequence>
</complexType>
</element>
</schema>
<schema elementFormDefault="qualified"
targetNamespace="http://ws.sosnoski.com/library/types"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="BookInformation">
<sequence>
<element name="author" minOccurs="0" maxOccurs="unbounded" type="string"/>
<element name="title" type="string"/>
</sequence>
<attribute name="type" use="required" type="string"/>
<attribute name="isbn" use="required" type="string"/>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getBookRequest">
<wsdl:part element="wns:getBook" name="parameters"/>
</wsdl:message>
<wsdl:message name="getBookResponse">
<wsdl:part element="wns:getBookResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getBooksByTypeRequest">
<wsdl:part element="wns:getBooksByType" name="parameters"/>
</wsdl:message>
<wsdl:message name="getBooksByTypeResponse">
<wsdl:part element="wns:getBooksByTypeResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="addBookRequest">
<wsdl:part element="wns:addBook" name="parameters"/>
</wsdl:message>
<wsdl:message name="addBookResponse">
<wsdl:part element="wns:addBookResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Library">
<wsdl:operation name="getBook">
<wsdl:input message="wns:getBookRequest" name="getBookRequest"/>
<wsdl:output message="wns:getBookResponse" name="getBookResponse"/>
</wsdl:operation>
<wsdl:operation name="getBooksByType">
<wsdl:input message="wns:getBooksByTypeRequest" name="getBooksByTypeRequest"/>
<wsdl:output message="wns:getBooksByTypeResponse" name="getBooksByTypeResponse"/>
</wsdl:operation>
<wsdl:operation name="addBook">
<wsdl:input message="wns:addBookRequest" name="addBookRequest"/>
<wsdl:output message="wns:addBookResponse" name="addBookResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="LibrarySoapBinding" type="wns:Library">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getBook">
<wsdlsoap:operation soapAction="urn:getBook"/>
<wsdl:input name="getBookRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getBookResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getBooksByType">
<wsdlsoap:operation soapAction="urn:getBooksByType"/>
<wsdl:input name="getBooksByTypeRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getBooksByTypeResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addBook">
<wsdlsoap:operation soapAction="urn:addBook"/>
<wsdl:input name="addBookRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addBookResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="library-username">
<wsdl:port binding="wns:LibrarySoapBinding" name="library">
<wsdlsoap:address location="http://localhost:8080/axis2/services/library-username"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,11 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class addBook
{
public $type;
public $isbn;
public $author;
public $title;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class addBookResponse
{
public $addBookReturn;
}

View File

@ -0,0 +1,9 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class base64Binary
{
public $_;
public $contentType;
}

View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICoDCCAgkCBEnhw2IwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNVBAYTAk5aMRMw
EQYDVQQIEwpXZWxsaW5ndG9uMRowGAYDVQQHExFQYXJhcGFyYXVtdSBCZWFjaDEq
MCgGA1UEChMhU29zbm9za2kgU29mdHdhcmUgQXNzb2NpYXRlcyBMdGQuMRAwDgYD
VQQLEwdVbmtub3duMRgwFgYDVQQDEw9EZW5uaXMgU29zbm9za2kwHhcNMDkwNDEy
MTAzMzA2WhcNMzYwODI3MTAzMzA2WjCBljELMAkGA1UEBhMCTloxEzARBgNVBAgT
CldlbGxpbmd0b24xGjAYBgNVBAcTEVBhcmFwYXJhdW11IEJlYWNoMSowKAYDVQQK
EyFTb3Nub3NraSBTb2Z0d2FyZSBBc3NvY2lhdGVzIEx0ZC4xEDAOBgNVBAsTB1Vu
a25vd24xGDAWBgNVBAMTD0Rlbm5pcyBTb3Nub3NraTCBnzANBgkqhkiG9w0BAQEF
AAOBjQAwgYkCgYEAhOVyNK8xyxtb4DnKtU6mF9KoiFqCk7eKoLE26+9h410CtTkx
zWAfgnR+8i+LPbdsPY+yXAo6NYpCCKolXfDLe+AG2GwnMZGrIl6+BLF3hqTmIXBF
TLGUmC7A7uBTivaWgdH1w3hb33rASoVU67BVtQ3QQi99juZX4vU9o9pScocCAwEA
ATANBgkqhkiG9w0BAQUFAAOBgQBMNPo1KAGbz8Jl6HGbtAcetieSJ3bEAXmv1tcj
ysBS67AXzdu1Ac+onHh2EpzBM7kuGbw+trU+AhulooPpewIQRApXP1F0KHRDcbqW
jwvknS6HnomN9572giLGKn2601bHiRUj35hiA8aLmMUBppIRPFFAoQ0QUBCPx+m8
/0n33w==
-----END CERTIFICATE-----

View File

@ -0,0 +1,14 @@
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAITlcjSvMcsbW+A5yrVOphfSqIha
gpO3iqCxNuvvYeNdArU5Mc1gH4J0fvIviz23bD2PslwKOjWKQgiqJV3wy3vgBthsJzGRqyJevgSx
d4ak5iFwRUyxlJguwO7gU4r2loHR9cN4W996wEqFVOuwVbUN0EIvfY7mV+L1PaPaUnKHAgMBAAEC
gYAZ6UqtLwN8YGc3fs0hMKZ9upsViuAuwPiMgED/G3twgzAF+ZLWQkmie+hMfCyf6eV200+pVm0n
Bz/8xH/oowxpX0Kk3szoB4vFghjU84GKUcrbhu/NRIm7l3drnfbzqhQkHDCx6n1CotI4Gs49cDWu
4uEAuxJkEIVY553unZjZgQJBAOJVIallNKmD0iQlvtWRmRzpmYDjt9vhNY6WBTIOx6SDn9SRaoSA
fkipQ2HXo04r78TQ674+zfZ1lRTkFG7px6ECQQCWUPHp3pSZOM1oGzJrNvNaw+MizZAZjq34npHm
9GRquFLG7BlCaI9QNGE7pN2ryYsYCRUMaM2e4GR0tUXxVGknAkAgrxqFU9AfCqI2Bh1gyf3KZxF7
w2axofwR8ygc6nV6FGfoUneHWubhp0/LuVAj4cRmL6Vbe8ZSaPh2Y9lviuMBAkEAicP8Q+1E4j1m
PPEYP51oYprANOiUFmhnWEL00+jPk+QFsd03tV6hYs/vAbwzkjuwqMHCMdJoCiH8z95IEUvc5wJA
MvLOuZdu4dmhOXg/YKsbMSPjFNEVskLQNSXqw6O2wIrpPg1NQvBBAOTbiuZj3vind4VPos1wc4vB
QocvdUC6dA==
-----END PRIVATE KEY-----

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class downloadFile
{
public $name;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class downloadFileResponse
{
public $data;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class getBook
{
public $isbn;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class getBookResponse
{
public $getBookReturn;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class getBooksByType
{
public $type;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class getBooksByTypeResponse
{
public $getBooksByTypeReturn;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICoDCCAgkCBEnhwzMwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNVBAYTAk5aMRMw
EQYDVQQIEwpXZWxsaW5ndG9uMRowGAYDVQQHExFQYXJhcGFyYXVtdSBCZWFjaDEq
MCgGA1UEChMhU29zbm9za2kgU29mdHdhcmUgQXNzb2NpYXRlcyBMdGQuMRAwDgYD
VQQLEwdVbmtub3duMRgwFgYDVQQDEw9EZW5uaXMgU29zbm9za2kwHhcNMDkwNDEy
MTAzMjE5WhcNMzYwODI3MTAzMjE5WjCBljELMAkGA1UEBhMCTloxEzARBgNVBAgT
CldlbGxpbmd0b24xGjAYBgNVBAcTEVBhcmFwYXJhdW11IEJlYWNoMSowKAYDVQQK
EyFTb3Nub3NraSBTb2Z0d2FyZSBBc3NvY2lhdGVzIEx0ZC4xEDAOBgNVBAsTB1Vu
a25vd24xGDAWBgNVBAMTD0Rlbm5pcyBTb3Nub3NraTCBnzANBgkqhkiG9w0BAQEF
AAOBjQAwgYkCgYEA1H3mjQCF9uce2jmm/Yq9kE4ytfvkp4c8G90cDfJXJvOiGQds
p2vDZXKuCkHQ7vsBBXPNTt8J/d8ZbEwyuB9Ccz5pJqi6Ig6Y2/mEsPthDyh5SrJV
yQ/wxUGwmfSuwdrIMnplMTq+OR9BOfT3CvjSvuy9d6BQNo4wOMkDvmZTtI8CAwEA
ATANBgkqhkiG9w0BAQUFAAOBgQCqv4475QaqlKcN2QCZJbLVKZEX+76XLQurGkgf
2fCgesRHjfUfOHyTTlhWQdEKTcBB2XviUyyW6I//fmKfXUIiQqvgh4LHdXRPEXDf
Y9nr89MjyQpDlnl6AlrvSej30a9iwVRUeVk4d6gxWHMRonKBFgh+TGexxUXHtPkf
B1Pdtg==
-----END CERTIFICATE-----

View File

@ -0,0 +1,9 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class uploadFile
{
public $data;
public $name;
}

View File

@ -0,0 +1,8 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class uploadFileResponse
{
public $return;
}

View File

@ -0,0 +1,52 @@
<?php
/*
* Deploy "axis_services/sample-mtom.aar" to Apache Axis2 to get this
* example to work.
*
* Apache Axis2 MTOM example.
*
*/
use BeSimple\SoapCommon\Helper as BeSimpleSoapHelper;
use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\AttachmentRequest;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\AttachmentType;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\base64Binary;
use BeSimple\SoapClient\Tests\AxisInterop\TestCase;
class MtomAxisInteropTest extends TestCase
{
private $options = array(
'soap_version' => SOAP_1_1,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
'cache_wsdl' => WSDL_CACHE_NONE,
'classmap' => array(
'base64Binary' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\base64Binary',
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\AttachmentRequest',
),
'proxy_host' => false,
);
public function testAttachment()
{
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/MTOM.wsdl', $this->options);
$b64 = new base64Binary();
$b64->_ = 'This is a test. :)';
$b64->contentType = 'text/plain';
$attachment = new AttachmentRequest();
$attachment->fileName = 'test123.txt';
$attachment->binaryData = $b64;
$this->assertEquals('File saved succesfully.', $sc->attachment($attachment));
// $fileCreatedByServer = __DIR__.'/'.$attachment->fileName;
// $this->assertEquals($b64->_, file_get_contents($fileCreatedByServer));
// unlink($fileCreatedByServer);
}
}

View File

@ -0,0 +1,38 @@
<project name="BeSimpleSwaService" default="generate.service">
<property environment="env" />
<property name="axis2.home" value="C:/axis2" />
<property name="axis2.repo" value="${axis2.home}/repository" />
<property name="build.dir" value="build" />
<property name="filename" value="besimple-swa.aar" />
<path id="axis.classpath">
<fileset dir="${axis2.home}/lib">
<include name="*.jar" />
</fileset>
</path>
<target name="generate.service" depends="compile">
<jar destfile="${build.dir}/${filename}">
<fileset dir="resources/">
<include name="META-INF/services.xml" />
</fileset>
<fileset dir="${build.dir}/classes">
<include name="besimple/service/**/*.class" />
</fileset>
</jar>
<copy file="${build.dir}/${filename}" tofile="../axis_services/${filename}" overwrite="true" />
<copy file="${build.dir}/${filename}" tofile="${axis2.repo}/services/${filename}" overwrite="true" />
<antcall target="clean" />
</target>
<target name="compile">
<mkdir dir="${build.dir}/classes" />
<javac debug="on" srcdir="src" destdir="${build.dir}/classes">
<classpath refid="axis.classpath" />
</javac>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>

View File

@ -0,0 +1,15 @@
<serviceGroup>
<service name="BeSimpleSwaService">
<description>BeSimple test service for SwA.</description>
<parameter name="enableSwA">true</parameter>
<parameter name="ServiceClass" locked="false">besimple.service.BeSimpleSwaService</parameter>
<operation name="uploadFile">
<actionMapping>urn:uploadFile</actionMapping>
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
<operation name="downloadFile">
<actionMapping>urn:downloadFile</actionMapping>
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
</service>
</serviceGroup>

View File

@ -0,0 +1,78 @@
package besimple.service;
import java.io.File;
import java.io.FileOutputStream;
import javax.xml.namespace.QName;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.wsdl.WSDLConstants;
public class BeSimpleSwaService {
String namespace = "http://service.besimple";
public OMElement uploadFile(OMElement element) throws Exception {
OMElement dataElement = (OMElement)element.getFirstChildWithName(new QName(namespace, "data"));
OMAttribute hrefAttribute = dataElement.getAttribute(new QName("href"));
String contentID = hrefAttribute.getAttributeValue();
contentID = contentID.trim();
if (contentID.substring(0, 3).equalsIgnoreCase("cid")) {
contentID = contentID.substring(4);
}
OMElement nameElement = (OMElement)element.getFirstChildWithName(new QName(namespace, "name"));
String name = nameElement.getText();
MessageContext msgCtx = MessageContext.getCurrentMessageContext();
Attachments attachment = msgCtx.getAttachmentMap();
DataHandler dataHandler = attachment.getDataHandler(contentID);
File file = new File(name);
FileOutputStream fileOutputStream = new FileOutputStream(file);
dataHandler.writeTo(fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace omNs = factory.createOMNamespace(namespace, "swa");
OMElement wrapperElement = factory.createOMElement("uploadFileResponse", omNs);
OMElement returnElement = factory.createOMElement("return", omNs, wrapperElement);
returnElement.setText("File saved succesfully.");
return wrapperElement;
}
public OMElement downloadFile(OMElement element) throws Exception {
OMElement nameElement = (OMElement)element.getFirstChildWithName(new QName(namespace, "name"));
String name = nameElement.getText();
MessageContext msgCtxIn = MessageContext.getCurrentMessageContext();
OperationContext operationContext = msgCtxIn.getOperationContext();
MessageContext msgCtxOut = operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
FileDataSource fileDataSource = new FileDataSource(name);
DataHandler dataHandler = new DataHandler(fileDataSource);
String contentID = "cid:" + msgCtxOut.addAttachment(dataHandler);
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace omNs = factory.createOMNamespace(namespace, "swa");
OMElement wrapperElement = factory.createOMElement("downloadFileResponse", omNs);
OMElement dataElement = factory.createOMElement("data", omNs, wrapperElement);
dataElement.addAttribute("href", contentID, null);
return wrapperElement;
}
}

View File

@ -0,0 +1,78 @@
<?php
/*
* Deploy "axis_services/besimple-swa.aar" to Apache Axis2 to get this
* example to work.
*
* Run ant to rebuild aar.
*
* Example based on:
* http://axis.apache.org/axis2/java/core/docs/mtom-guide.html#a3
* http://wso2.org/library/1675
*
* Doesn't work directly with ?wsdl served by Apache Axis!
*
*/
use BeSimple\SoapCommon\Helper as BeSimpleSoapHelper;
use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFile;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFileResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\downloadFile;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\downloadFileResponse;
use BeSimple\SoapClient\Tests\AxisInterop\TestCase;
class SwaAxisInteropTest extends TestCase
{
private $options = array(
'soap_version' => SOAP_1_1,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_SWA,
'cache_wsdl' => WSDL_CACHE_NONE,
'classmap' => array(
'downloadFile' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\downloadFile',
'downloadFileResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\downloadFileResponse',
'uploadFile' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFile',
'uploadFileResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFileResponse',
),
'proxy_host' => false,
);
public function testUploadDownloadText()
{
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $this->options);
$upload = new uploadFile();
$upload->name = 'upload.txt';
$upload->data = 'This is a test. :)';
$result = $sc->uploadFile($upload);
$this->assertEquals('File saved succesfully.', $result->return);
$download = new downloadFile();
$download->name = 'upload.txt';
$result = $sc->downloadFile($download);
$this->assertEquals($upload->data, $result->data);
}
public function testUploadDownloadImage()
{
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $this->options);
$upload = new uploadFile();
$upload->name = 'image.jpg';
$upload->data = file_get_contents(__DIR__.'/Fixtures/image.jpg'); // source: http://www.freeimageslive.com/galleries/light/pics/swirl3768.jpg;
$result = $sc->uploadFile($upload);
$this->assertEquals('File saved succesfully.', $result->return);
$download = new downloadFile();
$download->name = 'image.jpg';
$result = $sc->downloadFile($download);
$this->assertEquals($upload->data, $result->data);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace BeSimple\SoapClient\Tests\AxisInterop;
class TestCase extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$ch = curl_init('http://localhost:8080/');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (curl_exec($ch) === false) {
$this->markTestSkipped(
'The Axis server is not started on port 8080.'
);
}
curl_close($ch);
}
}

View File

@ -0,0 +1,60 @@
<?php
/*
* Deploy "axis_services/version2.aar" to Apache Axis2 to get this example to
* work.
*
* To rebuild the "axis_services/version2.aar" the following steps need to be
* done to build a working Apache Axis2 version service with SOAP session
* enabled.
*
* 1) Go to $AXIS_HOME/samples/version and edit the following files:
*
* resources/META-INF/services.xml:
* <service name="Version2" scope="soapsession">
* ...
* </service>
*
* build.xml:
* replace version.aar with version2.aar
*
* 2) Run ant build.xml in "$AXIS_HOME/samples/version"
*
*/
use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
use BeSimple\SoapClient\WsAddressingFilter as BeSimpleWsAddressingFilter;
use BeSimple\SoapClient\Tests\AxisInterop\TestCase;
class WsAddressingAxisInteropTest extends TestCase
{
private $options = array(
'soap_version' => SOAP_1_2,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
'proxy_host' => false,
);
public function testSession()
{
$sc = new BeSimpleSoapClient('http://localhost:8080/axis2/services/Version2?wsdl', $this->options);
$soapKernel = $sc->getSoapKernel();
$wsaFilter = new BeSimpleWsAddressingFilter();
$soapKernel->registerFilter($wsaFilter);
$wsaFilter->setReplyTo(BeSimpleWsAddressingFilter::ENDPOINT_REFERENCE_ANONYMOUS);
$wsaFilter->setMessageId();
$version = $sc->getVersion();
$soapSessionId1 = $wsaFilter->getReferenceParameter('http://ws.apache.org/namespaces/axis2', 'ServiceGroupId');
$wsaFilter->addReferenceParameter('http://ws.apache.org/namespaces/axis2', 'axis2', 'ServiceGroupId', $soapSessionId1);
$version = $sc->getVersion();
$soapSessionId2 = $wsaFilter->getReferenceParameter('http://ws.apache.org/namespaces/axis2', 'ServiceGroupId');
$this->assertEquals($soapSessionId1, $soapSessionId2);
}
}

View File

@ -0,0 +1,107 @@
<?php
/*
* Deploy "axis_services/library-signencr.aar" to Apache Axis2 to get this
* example to work.
*
* Links:
* http://www.dcc.uchile.cl/~pcamacho/tutorial/web/xmlsec/xmlsec.html
* http://www.aleksey.com/xmlsec/xmldsig-verifier.html
*
* Using code from axis example:
* http://www.ibm.com/developerworks/java/library/j-jws5/index.html
*
* Download key tool to export private key
* http://couchpotato.net/pkeytool/
*
* keytool -export -alias serverkey -keystore server.keystore -storepass nosecret -file servercert.cer
* openssl x509 -out servercert.pem -outform pem -in servercert.pem -inform der
*
* keytool -export -alias clientkey -keystore client.keystore -storepass nosecret -file clientcert.cer
* openssl x509 -out clientcert.pem -outform pem -in clientcert.pem -inform der
* java -jar pkeytool.jar -exportkey -keystore client.keystore -storepass nosecret -keypass clientpass -rfc -alias clientkey -file clientkey.pem
*
* C:\Program Files\Java\jre6\bin\keytool -export -alias serverkey -keystore server.keystore -storepass nosecret -file servercert.cer
* C:\xampp\apache\bin\openssl x509 -out servercert.pem -outform pem -in servercert.cer -inform der
*
* C:\Program Files\Java\jre6\bin\keytool -export -alias clientkey -keystore client.keystore -storepass nosecret -file clientcert.cer
* C:\xampp\apache\bin\openssl x509 -out clientcert.pem -outform pem -in clientcert.cer -inform der
* java -jar C:\axis2\pkeytool\pkeytool.jar -exportkey -keystore client.keystore -storepass nosecret -keypass clientpass -rfc -alias clientkey -file clientkey.pem
*
* build.properties:
* server-policy=hash-policy-server.xml
*
* allows both text and digest!
*/
use ass\XmlSecurity\Key as XmlSecurityKey;
use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
use BeSimple\SoapClient\WsSecurityFilter as BeSimpleWsSecurityFilter;
use BeSimple\SoapCommon\WsSecurityKey as BeSimpleWsSecurityKey;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBook;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBookResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByType;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByTypeResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBook;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation;
use BeSimple\SoapClient\Tests\AxisInterop\TestCase;
class WsSecuritySigEncAxisInteropTest extends TestCase
{
private $options = array(
'soap_version' => SOAP_1_2,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
'classmap' => array(
'getBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBook',
'getBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBookResponse',
'getBooksByType' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByType',
'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByTypeResponse',
'addBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBook',
'addBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation',
),
'proxy_host' => false,
);
public function testSigEnc()
{
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecuritySigEnc.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter();
// user key for signature and encryption
$securityKeyUser = new BeSimpleWsSecurityKey();
$securityKeyUser->addPrivateKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientkey.pem', true);
$securityKeyUser->addPublicKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientcert.pem', true);
$wssFilter->setUserSecurityKeyObject($securityKeyUser);
// service key for encryption
$securityKeyService = new BeSimpleWsSecurityKey();
$securityKeyService->addPrivateKey(XmlSecurityKey::TRIPLEDES_CBC);
$securityKeyService->addPublicKey(XmlSecurityKey::RSA_1_5, __DIR__.'/Fixtures/servercert.pem', true);
$wssFilter->setServiceSecurityKeyObject($securityKeyService);
// TOKEN_REFERENCE_SUBJECT_KEY_IDENTIFIER | TOKEN_REFERENCE_SECURITY_TOKEN | TOKEN_REFERENCE_THUMBPRINT_SHA1
$wssFilter->setSecurityOptionsSignature(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_SECURITY_TOKEN);
$wssFilter->setSecurityOptionsEncryption(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_THUMBPRINT_SHA1);
$soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter);
$gb = new getBook();
$gb->isbn = '0061020052';
$result = $sc->getBook($gb);
$this->assertInstanceOf('BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation', $result->getBookReturn);
$ab = new addBook();
$ab->isbn = '0445203498';
$ab->title = 'The Dragon Never Sleeps';
$ab->author = 'Cook, Glen';
$ab->type = 'scifi';
$this->assertTrue((bool) $sc->addBook($ab));
// getBooksByType("scifi");
}
}

View File

@ -0,0 +1,97 @@
<?php
/*
* Deploy "axis_services/library-username-digest.aar" to Apache Axis2 to get
* this example to work.
*
* Using code from axis example:
* http://www.ibm.com/developerworks/java/library/j-jws4/index.html
*
* build.properties:
* server-policy=hash-policy-server.xml
*
* allows both text and digest!
*/
use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
use BeSimple\SoapClient\WsSecurityFilter as BeSimpleWsSecurityFilter;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBook;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBookResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByType;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByTypeResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBook;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse;
use BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation;
use BeSimple\SoapClient\Tests\AxisInterop\TestCase;
class WsSecurityUserPassAxisInteropTest extends TestCase
{
private $options = array(
'soap_version' => SOAP_1_2,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
'classmap' => array(
'getBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBook',
'getBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBookResponse',
'getBooksByType' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByType',
'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByTypeResponse',
'addBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBook',
'addBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation',
),
'proxy_host' => false,
);
public function testUserPassText()
{
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter(true, 600);
$wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_TEXT);
$soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter);
$gb = new getBook();
$gb->isbn = '0061020052';
$result = $sc->getBook($gb);
$this->assertInstanceOf('BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation', $result->getBookReturn);
$ab = new addBook();
$ab->isbn = '0445203498';
$ab->title = 'The Dragon Never Sleeps';
$ab->author = 'Cook, Glen';
$ab->type = 'scifi';
$this->assertTrue((bool) $sc->addBook($ab));
// getBooksByType("scifi");
}
public function testUserPassDigest()
{
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter(true, 600);
$wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST);
$soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter);
$gb = new getBook();
$gb->isbn = '0061020052';
$result = $sc->getBook($gb);
$this->assertInstanceOf('BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation', $result->getBookReturn);
$ab = new addBook();
$ab->isbn = '0445203498';
$ab->title = 'The Dragon Never Sleeps';
$ab->author = 'Cook, Glen';
$ab->type = 'scifi';
$this->assertTrue((bool) $sc->addBook($ab));
// getBooksByType("scifi");
}
}

Some files were not shown because too many files have changed in this diff Show More