Compare commits

...

174 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
Petr Bechyně
ab83642f06 Parser fix: single line MimeMessages are now parsed correctly 2017-04-06 15:51:29 +02:00
Petr Bechyně
564005da93 SoapServer/Client now handle binary files correctly & large tests/fixtures update
Soap Server and Client were breaking binary files during transfer due to invalid Mime Message Parser. Now is it working fine with no errors, but the message parser is about to be rewritten into a better form.
2017-04-04 18:36:18 +02:00
Petr Bechyně
311f9e6d08 Readme update: better examples added 2017-03-15 11:23:21 +01:00
Petr Bechyně
e67d5aa84b Readme updated 2017-03-15 10:48:23 +01:00
Petr Bechyně
d3023b1a5a UnitTests are now located in tests directory & tiny improvements 2017-03-15 10:25:48 +01:00
Petr Bechyně
21d705bbfa SoapClient custom endpoint location & connection keep alive configuration added & tests updated 2017-03-03 11:11:44 +01:00
Petr Bechyně
0e2c33faf8 Support of older PHP versions removed: MimeFilter does not sanitize PHP 5.4.x error 2017-02-22 12:23:24 +01:00
Petr Bechyně
cf6e147c26 Merge remote-tracking branch 'remotes/origin/develop' 2017-02-18 00:14:21 +01:00
Petr Bechyně
f276a30a47 Curl/WsdlGenerator - better error handling 2017-02-18 00:13:02 +01:00
Petr Bechyně
4edc46e67f Parser fix - MimeMessages with CRLF caused iconv_mime_decode throwing Exceptions 2017-02-17 15:06:06 +01:00
Petr Bechyně
a76526a5b6 DEFAULT_CONNECTION_TIMEOUT default value increased to 120 2017-02-17 11:20:09 +01:00
Petr Bechyně
baf32c1350 Curl is now returning response body even on error
It is better to switch off CURLOPT_FAILONERROR and check response status manually by HTTP response code
2017-02-17 11:07:26 +01:00
Petr Bechyně
5c0bf914e3 Unused SoapClientNativeDataTransferObject removed 2017-02-17 03:36:16 +01:00
Petr Bechyně
01d10b89fd SoapClient now handles Attachments better
The inner storage is now the only possible way to handle attachments and hydrate responses by using ClassMap at the same time. To get the response objects from ClassMap, use SoapResponse->getResponseObject() method
2017-02-17 03:19:22 +01:00
Petr Bechyně
e1b50ce914 SoapClient::__soapCall() must be compatible with \SoapClient::__soapCall() fix 2017-02-17 00:26:01 +01:00
Petr Bechyně
68b41acc46 SoapClient - WSDL download fixes 2017-02-17 00:14:05 +01:00
Petr Bechyně
30a9707c59 Merge remote-tracking branch 'remotes/origin/develop' 2017-02-14 16:48:58 +01:00
Petr Bechyně
aee034791e SoapClient large refactoring & tests update 2017-02-14 16:01:39 +01:00
Petr Bechyně
00ddf149b0 Passing SOAP fault with detail 2016-11-29 18:55:55 +01:00
Petr Bechyně
476813e9bb MIME parts now contain only LF (was CRLF) 2016-11-29 18:55:55 +01:00
Petr Bechyně
f57239ad0d MultiPart Boundary generator changed 2016-11-24 15:18:00 +01:00
Petr Bechyně
10caf27da3 MultiPart ContentId is now in different format 2016-11-24 15:00:46 +01:00
Petr Bechyně
51d1abab48 Connection: Keep-alive is now configurable - BUT NOW WORKING
PHP is unable to change Connection type, this configuration is quite missleading for SoapServer, but still working for SoapClient
2016-11-24 12:47:01 +01:00
Petr Bechyně
1224f5f40f Content-Location added for attachment parts 2016-11-24 12:45:17 +01:00
Petr Bechyně
f4a4619fe6 Handling SoapRequests/SoapResponse with attachments fix 2016-11-24 11:04:57 +01:00
Petr Bechyně
052ab20d67 tiny bugfixes 2016-11-11 16:04:44 +01:00
Petr Bechyně
dd7b6904b6 SoapOptions moved 2016-11-09 17:05:43 +01:00
Petr Bechyně
c4d993585f SoapServer now handles get WSDL requests 2016-11-09 13:43:18 +01:00
Petr Bechyně
bd1fbf9cfc SoapServer::handle() has to be compatible with \SoapServer 2016-11-09 12:08:32 +01:00
Petr Bechyně
5fbcfb3e22 AttachmentsHandlerInterface refactored 2016-11-08 18:31:28 +01:00
Petr Bechyně
84c37b1d24 Soap server with attachments refactoring 2016-11-08 15:42:52 +01:00
Petr Bechyně
8d033f9afc SoapResponse is a product of SoapResponseFactory, small refactorings 2016-11-02 16:08:21 +01:00
Petr Bechyně
bf494a42b5 MimeFilters are now stateless 2016-11-02 09:55:12 +01:00
Petr Bechyně
969709cae5 Large refactoring of SoapKernel 2016-11-01 18:13:23 +01:00
Petr Bechyně
155aa029ce SoapRequest is now SoapRequestFactory product 2016-11-01 16:23:21 +01:00
Petr Bechyně
3c0f731086 SoapOptions cache dir introduced + SoapOptionsBuilder - new methods added 2016-11-01 09:24:41 +01:00
Petr Bechyně
374c64538a remove useless SoapClientBuilder 2016-10-31 14:12:35 +01:00
Petr Bechyně
4d7894b66e Composer info updated 2016-10-27 16:38:53 +02:00
Petr Bechyně
0a157748a8 Large refactoring removing states, abstract magic, vague fluent interfaces 2016-10-27 16:24:44 +02:00
Cameron Murphy
c4a9b58b08 Use request_stack service instead of deprecated request service 2016-01-11 16:28:20 +11:00
Cameron Murphy
fc15bf36ab Call getPath() instead of string casting 2016-01-11 16:28:05 +11:00
Cameron Murphy
8462233a08 Update FlattenException use statements 2016-01-11 16:20:13 +11:00
Cameron Murphy
03227295f6 Use ContainerAwareTrait and ContainerAwareInterface 2016-01-11 16:09:42 +11:00
Cameron Murphy
f285adfa14 Use path attribute rather than pattern 2016-01-11 16:06:22 +11:00
Cameron Murphy
2ecdbe9714 Change package name and description 2016-01-08 11:47:15 +11:00
Cameron Murphy
e5c54164c1 Support Symfony 3.* 2016-01-08 11:42:56 +11:00
Francis Besset
27ebf0fbce Merge remote-tracking branch 'origin/0.2' 2015-06-01 16:04:32 +02:00
Francis Besset
855e382590 [SoapBundle] Fixed service definition with factory 2015-06-01 16:04:29 +02:00
Francis Besset
2974a4f838 Stop support of Symfony <2.6 2015-06-01 16:04:24 +02:00
Francis Besset
f2a8a7ebb3 Merge branch '0.2' 2014-08-18 14:20:19 +02:00
Francis Besset
bbd4c26134 Merge branch '0.2' 2014-08-16 15:48:45 +02:00
Francis Besset
294a9fe90e Stop support of Symfony <2.3 2014-08-14 15:02:52 +02:00
Francis Besset
313840d5a4 Revert "[SoapClient] [Tests] Down required version of symfony/filesystem vendor"
This reverts commit 726ee89936aa92c27b09589c8c4355930a414665.

Conflicts:
	composer.json
	src/BeSimple/SoapClient/composer.json
2014-08-14 14:57:00 +02:00
Francis Besset
8e4d8b0300 Updated BeSimpleSoap vendor requierement to 0.3 2014-08-14 14:56:39 +02:00
Francis Besset
621b2080e0 Updated version to 0.3 2014-08-14 14:21:49 +02:00
101 changed files with 550 additions and 342 deletions

3
.gitignore vendored
View File

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

View File

@ -1,20 +1,16 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
env:
- SYMFONY_VERSION=2.0.*
- SYMFONY_VERSION=2.1.*
- SYMFONY_VERSION=2.2.*
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.4.*
- SYMFONY_VERSION=2.5.*
- SYMFONY_VERSION="dev-master symfony/debug:~2.6@dev symfony/http-kernel:~2.6@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
@ -26,4 +22,4 @@ script:
matrix:
allow_failures:
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.6@dev symfony/http-kernel:~2.6@dev"
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.8@dev symfony/http-kernel:~2.8@dev"

154
README.md
View File

@ -1,56 +1,146 @@
# BeSimpleSoap
# BeSimpleSoap (Symfony 3.4 / 4.x)
Build SOAP and WSDL based web services
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
BeSimpleSoap consists of five components ...
## BeSimpleSoapBundle
The BeSimpleSoapBundle is a Symfony2 bundle to build WSDL and SOAP based web services.
For further information see the [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapBundle/README.md).
## BeSimpleSoapClient
The BeSimpleSoapClient is a component that extends the native PHP SoapClient with further features like SwA, MTOM and WS-Security.
For further information see the [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapClient/README.md).
## BeSimpleSoapCommon
The BeSimpleSoapCommon component contains functionylity shared by both the server and client implementations.
For further information see the [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapCommon/README.md).
**Refactored** BeSimpleSoapClient is a component that extends the native PHP SoapClient with further features like SwA and WS-Security.
## BeSimpleSoapServer
The BeSimpleSoapServer is a component that extends the native PHP SoapServer with further features like SwA, MTOM and WS-Security.
For further information see the [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapServer/README.md).
**Refactored** BeSimpleSoapServer is a component that extends the native PHP SoapServer with further features like SwA and WS-Security.
## BeSimpleSoapCommon
**Refactored** BeSimpleSoapCommon component contains functionality shared by both the server and client implementations.
## BeSimpleSoapWsdl
For further information see the [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapWsdl/README.md).
**Untouched!**
The component is not affected by refactoring so it should work properly.
For further information see the original [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapWsdl/README.md).
# Installation
## BeSimpleSoapBundle
If you do not yet have composer, install it like this:
**Unsupported!**
The BeSimpleSoapBundle is a Symfony2 bundle to build WSDL and SOAP based web services.
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!*
```sh
curl -s http://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin
# 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,
but it will guide you to configure and set up your client or server properly.
## Example of soap client call
```php
$soapClientBuilder = new SoapClientBuilder();
$soapClient = $soapClientBuilder->build(
SoapClientOptionsBuilder::createWithDefaults(),
SoapOptionsBuilder::createWithDefaults('http://path/to/wsdlfile.wsdl')
);
$myRequest = new MyRequest();
$myRequest->attribute = 'string value';
$soapResponse = $soapClient->soapCall('myMethod', [$myRequest]);
var_dump($soapResponse); // Contains Response, Attachments
```
Create a `composer.json` file:
### Something wrong?!
```json
Turn on the tracking and catch `SoapFaultWithTracingData` exception to get some sweets :)
```php
try {
$soapResponse = $soapClient->soapCall('myMethod', [$myRequest]);
} catch (SoapFaultWithTracingData $fault) {
var_dump($fault->getSoapResponseTracingData()->getLastRequest());
}
```
In this example, a ``MyRequest`` object has been used to describe request.
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.
```php
$dummyService = new DummyService();
$classMap = new ClassMap();
foreach ($dummyService->getClassMap() as $type => $className) {
$classMap->add($type, $className);
}
$soapServerBuilder = new SoapServerBuilder();
$soapServerOptions = SoapServerOptionsBuilder::createWithDefaults($dummyService);
$soapOptions = SoapOptionsBuilder::createWithClassMap($dummyService->getWsdlPath(), $classMap);
$soapServer = $soapServerBuilder->build($soapServerOptions, $soapOptions);
$request = $soapServer->createRequest(
$dummyService->getEndpoint(),
'DummyService.dummyServiceMethod',
'text/xml;charset=UTF-8',
'<received><soap><request><here /></request></soap></received>'
);
$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.
You can hold a class map as ``ClassMap`` object directly in the ``DummyService`` instead of array.
In the service you should describe SOAP methods from given WSDL.
In the example, the dummyServiceMethod is called.
The method will receive request object and return response object that are matched according to the class map.
See a simplified implementation of ``dummyServiceMethod`` to get a clue:
```php
/**
* @param DummyServiceRequest $dummyServiceRequest
* @return DummyServiceResponse
*/
public function dummyServiceMethod(DummyServiceRequest $dummyServiceRequest)
{
"require": {
"besimple/soap": "0.2.*@dev"
}
$response = new DummyServiceResponse();
$response->status = true;
return $response;
}
```
Now you are ready to install the library:
```sh
php /usr/local/bin/composer.phar install
```
For further information and getting inspiration for your implementation, see the unit tests in ``tests`` dir.

View File

@ -1,9 +1,9 @@
{
"name": "besimple/soap",
"name": "cadoles/soap",
"type": "library",
"description": "Build and consume SOAP and WSDL based web services",
"keywords": ["soap"],
"homepage": "http://besim.pl",
"homepage": "https://github.com/Cadoles/BeSimpleSoap",
"license": "MIT",
"authors": [
{
@ -20,33 +20,34 @@
}
],
"require": {
"php": ">=5.3.0",
"php": ">=7.0",
"ext-soap": "*",
"ext-curl": "*",
"ass/xmlsecurity": "~1.0",
"symfony/framework-bundle": "~2.0",
"symfony/twig-bundle": "~2.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",
"symfony/filesystem": "~2.0",
"symfony/process": "~2.3"
"mikey179/vfsstream": "~1.6.5",
"symfony/filesystem": "~2.3",
"symfony/process": "~2.3",
"phpunit/phpunit": "^5.7"
},
"autoload": {
"psr-0": { "BeSimple\\": "src/" }
},
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"
"dev-master": "5.2.0-dev"
}
}
}

View File

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

View File

@ -15,21 +15,26 @@ 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\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
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>
* @author Francis Besset <francis.besset@gmail.com>
*/
class SoapWebServiceController extends ContainerAware
class SoapWebServiceController implements ContainerAwareInterface
{
use ContainerAwareTrait;
/**
* @var \SoapServer
*/
@ -53,19 +58,20 @@ class SoapWebServiceController extends ContainerAware
/**
* @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'));
$this->soapServer = $webServiceContext
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request_stack')->getCurrentRequest());
$this->soapServer = $webServiceContext
->getServerBuilder()
->withSoapVersion11()
->withHandler($this)
@ -83,19 +89,26 @@ class SoapWebServiceController extends ContainerAware
}
/**
* @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');
@ -121,14 +134,14 @@ class SoapWebServiceController extends ContainerAware
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')) {
@ -162,8 +175,8 @@ class SoapWebServiceController extends ContainerAware
* 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
*/
@ -220,7 +233,7 @@ class SoapWebServiceController extends ContainerAware
}
/**
* Set the SoapResponse
* Set the SoapResponse.
*
* @param Response $response A response to check and set
*
@ -237,7 +250,7 @@ class SoapWebServiceController extends ContainerAware
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,10 +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->setFactoryService(sprintf('besimple.soap.client.builder.%s', $client));
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)
@ -156,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'])) {
@ -165,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

@ -13,8 +13,8 @@
namespace BeSimple\SoapBundle\Handler;
use BeSimple\SoapServer\Exception\ReceiverSoapFault;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
/**
* @author Francis Besset <francis.besset@gmail.com>

View File

@ -19,7 +19,9 @@
<argument type="service" id="besimple.soap.cache" /> <!-- hack to load besimple cache configuration -->
</service>
<service id="besimple.soap.client" factory-service="besimple.soap.client.builder" factory-method="build" class="%besimple.soap.client.builder.class%" abstract="true" />
<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>

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" pattern="/{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" pattern="/{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

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

@ -44,7 +44,7 @@ class WebServiceContext
if (null === $this->serviceDefinition) {
$cache = new ConfigCache(sprintf('%s/%s.definition.php', $this->options['cache_dir'], $this->options['name']), $this->options['debug']);
if ($cache->isFresh()) {
$this->serviceDefinition = include (string) $cache;
$this->serviceDefinition = include $cache->getPath();
} else {
if (!$this->loader->supports($this->options['resource'], $this->options['resource_type'])) {
throw new \LogicException(sprintf('Cannot load "%s" (%s)', $this->options['resource'], $this->options['resource_type']));
@ -68,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) {
@ -82,7 +82,7 @@ class WebServiceContext
$cache->write($dumper->dump());
}
return (string) $cache;
return $cache->getPath();
}
public function getServiceBinder()

View File

@ -25,8 +25,8 @@
"besimple/soap-common": "0.2.*",
"besimple/soap-wsdl": "0.2.*",
"ass/xmlsecurity": "~1.0",
"symfony/framework-bundle": "~2.0",
"symfony/twig-bundle": "~2.0",
"symfony/framework-bundle": "~2.0|~3.0",
"symfony/twig-bundle": "~2.0|~3.0",
"zendframework/zend-mime": "2.1.*"
},
"suggest": {

View File

@ -77,9 +77,8 @@ class Curl
if (isset($options['compression']) && !($options['compression'] & SOAP_COMPRESSION_ACCEPT)) {
curl_setopt($this->ch, CURLOPT_ENCODING, 'identity');
}
if (isset($options['connection_timeout'])) {
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $options['connection_timeout']);
}
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 10);
if (isset($options['proxy_host'])) {
if (false !== $options['proxy_host']) {
@ -167,7 +166,6 @@ class Curl
private function execManualRedirect($redirects = 0)
{
if ($redirects > $this->followLocationMaxRedirects) {
// TODO Redirection limit reached, aborting
return false;
}
@ -193,7 +191,7 @@ class Curl
if (!isset($url['path'])) {
$url['path'] = $lastUrl['path'];
}
$newUrl = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query'] ? '?' . $url['query'] : '');
$newUrl = $url['scheme'].'://'.$url['host'].$url['path'].($url['query'] ? '?'.$url['query'] : '');
curl_setopt($this->ch, CURLOPT_URL, $newUrl);
return $this->execManualRedirect($redirects++);
@ -205,7 +203,7 @@ class Curl
/**
* Error code mapping from cURL error codes to PHP ext/soap error messages
* (where applicable)
* (where applicable).
*
* http://curl.haxx.se/libcurl/c/libcurl-errors.html
*
@ -251,7 +249,6 @@ class Curl
$errorCodeMapping = $this->getErrorCodeMapping();
$errorNumber = curl_errno($this->ch);
if (isset($errorCodeMapping[$errorNumber])) {
return $errorCodeMapping[$errorNumber];
}

View File

@ -338,10 +338,10 @@ class SoapClient extends \SoapClient
$options['typemap'][] = array(
'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function($input) use ($converter) {
'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input);
},
'to_xml' => function($input) use ($converter) {
'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input);
},
);
@ -380,4 +380,4 @@ class SoapClient extends \SoapClient
return $cacheFileName;
}
}
}

View File

@ -45,4 +45,4 @@ class SoapRequest extends CommonSoapRequest
return $request;
}
}
}

View File

@ -23,8 +23,7 @@ abstract class AbstractWebServerTest extends \PHPUnit_Framework_TestCase
/**
* @var ProcessBuilder
*/
static protected $webserver;
static protected $websererPortLength;
protected static $webserver;
public static function setUpBeforeClass()
{
@ -44,8 +43,6 @@ abstract class AbstractWebServerTest extends \PHPUnit_Framework_TestCase
self::$webserver->start();
usleep(100000);
self::$websererPortLength = strlen(WEBSERVER_PORT);
}
public static function tearDownAfterClass()

View File

@ -4,4 +4,4 @@ namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class AttachmentRequest extends AttachmentType
{
}
}

View File

@ -6,4 +6,4 @@ class AttachmentType
{
public $fileName;
public $binaryData;
}
}

View File

@ -20,4 +20,4 @@ class TestCase extends \PHPUnit_Framework_TestCase
curl_close($ch);
}
}
}

View File

@ -74,7 +74,7 @@ class WsSecurityUserPassAxisInteropTest extends TestCase
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter(true, 600);
$wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST );
$wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST);
$soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter);

View File

@ -45,19 +45,6 @@ class CurlTest extends AbstractWebserverTest
$this->assertEquals('Unable to parse URL', $curl->getErrorMessage());
}
public function testGetRequestHeaders()
{
$curl = new Curl(array(
'proxy_host' => false,
));
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
$this->assertEquals(132 + self::$websererPortLength, strlen($curl->getRequestHeaders()));
$curl->exec(sprintf('http://localhost:%s/404.txt', WEBSERVER_PORT));
$this->assertEquals(131 + self::$websererPortLength, strlen($curl->getRequestHeaders()));
}
public function testGetResponse()
{
$curl = new Curl(array(
@ -66,7 +53,6 @@ class CurlTest extends AbstractWebserverTest
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
$this->assertSame('OK', $curl->getResponseStatusMessage());
$this->assertEquals(145 + self::$websererPortLength, strlen($curl->getResponse()));
$curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT));
$this->assertSame('Not Found', $curl->getResponseStatusMessage());
@ -95,19 +81,6 @@ class CurlTest extends AbstractWebserverTest
$this->assertEquals('text/html; charset=UTF-8', $curl->getResponseContentType());
}
public function testGetResponseHeaders()
{
$curl = new Curl(array(
'proxy_host' => false,
));
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
$this->assertEquals(117 + self::$websererPortLength, strlen($curl->getResponseHeaders()));
$curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT));
$this->assertEquals(124 + self::$websererPortLength, strlen($curl->getResponseHeaders()));
}
public function testGetResponseStatusCode()
{
$curl = new Curl(array(

View File

@ -4,4 +4,4 @@ namespace BeSimple\SoapClient\Tests\ServerInterop\Fixtures;
class AttachmentRequest extends AttachmentType
{
}
}

View File

@ -6,4 +6,4 @@ class AttachmentType
{
public $fileName;
public $binaryData;
}
}

View File

@ -36,7 +36,6 @@ try {
$attachment->binaryData = $b64;
var_dump($sc->attachment($attachment));
} catch (Exception $e) {
var_dump($e);
}
@ -46,4 +45,4 @@ try {
// $sc->__getLastRequest(),
// $sc->__getLastResponseHeaders(),
// $sc->__getLastResponse()
// );
// );

View File

@ -29,7 +29,6 @@ $options = array(
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $options);
try {
$upload = new uploadFile();
$upload->name = 'upload.txt';
$upload->data = 'This is a test. :)';
@ -49,4 +48,4 @@ try {
// $sc->__getLastRequest(),
// $sc->__getLastResponseHeaders(),
// $sc->__getLastResponse()
// );
// );

View File

@ -26,4 +26,4 @@ class TestCase extends \PHPUnit_Framework_TestCase
curl_close($ch);
}
}
}

View File

@ -69,7 +69,6 @@ try {
$ab->type = 'scifi';
var_dump($sc->addBook($ab));
} catch (Exception $e) {
var_dump($e);
}

View File

@ -54,7 +54,6 @@ try {
$ab->type = 'scifi';
var_dump($sc->addBook($ab));
} catch (Exception $e) {
var_dump($e);
}

View File

@ -63,7 +63,7 @@ class WsSecurityUserPassServerInteropTest extends TestCase
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter(true, 600);
$wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST );
$wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST);
$soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter);

View File

@ -25,9 +25,9 @@ use org\bovigo\vfs\vfsStreamWrapper;
*/
class WsdlDownloaderTest extends AbstractWebserverTest
{
static protected $filesystem;
protected static $filesystem;
static protected $fixturesPath;
protected static $fixturesPath;
/**
* @dataProvider provideDownload

View File

@ -157,7 +157,6 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
public function getReferenceParameter($ns, $parameter)
{
if (isset($this->referenceParametersRecieved[$ns][$parameter])) {
return $this->referenceParametersRecieved[$ns][$parameter];
}
@ -344,4 +343,4 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
}
}
}
}
}

View File

@ -151,7 +151,6 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
if (null !== $this->password
&& (null === $this->userSecurityKey
|| (null !== $this->userSecurityKey && !$this->userSecurityKey->hasPrivateKey()))) {
if (self::PASSWORD_TYPE_DIGEST === $this->passwordType) {
$nonce = mt_rand();
$password = base64_encode(sha1($nonce . $createdTimestamp . $this->password, true));

View File

@ -56,7 +56,7 @@ class WsdlDownloader
/**
* Resolve WSDl/XSD includes.
*
* @var boolean
* @var bool
*/
protected $resolveRemoteIncludes = true;
@ -64,13 +64,13 @@ class WsdlDownloader
* Constructor.
*
* @param \BeSimple\SoapClient\Curl $curl Curl instance
* @param boolean $resolveRemoteIncludes WSDL/XSD include enabled?
* @param boolean $cacheWsdl Cache constant
* @param bool $resolveRemoteIncludes WSDL/XSD include enabled?
* @param bool $cacheWsdl Cache constant
*/
public function __construct(Curl $curl, $resolveRemoteIncludes = true, $cacheWsdl = Cache::TYPE_DISK)
{
$this->curl = $curl;
$this->resolveRemoteIncludes = (Boolean) $resolveRemoteIncludes;
$this->curl = $curl;
$this->resolveRemoteIncludes = (bool) $resolveRemoteIncludes;
// get current WSDL caching config
$this->cacheEnabled = $cacheWsdl === Cache::TYPE_NONE ? Cache::DISABLED : Cache::ENABLED == Cache::isEnabled();
@ -101,19 +101,33 @@ class WsdlDownloader
if ($responseSuccessfull) {
$response = $this->curl->getResponseBody();
libxml_use_internal_errors(true);
$doc = simplexml_load_string($response);
if (!$doc) {
$errors = libxml_get_errors();
if (count($errors)) {
throw new \Exception('There is something wrong with the WSDL file formatting. The file can\'t be downloaded to be cached.');
}
libxml_clear_errors();
}
if ($this->resolveRemoteIncludes) {
$this->resolveRemoteIncludes($response, $cacheFilePath, $wsdl);
} else {
file_put_contents($cacheFilePath, $response);
}
} else {
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl ."'");
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '".$wsdl."'");
}
} elseif (file_exists($wsdl)) {
$response = file_get_contents($wsdl);
$this->resolveRemoteIncludes($response, $cacheFilePath);
} else {
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl ."'");
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '".$wsdl."'");
}
}
@ -122,7 +136,7 @@ class WsdlDownloader
return realpath($wsdl);
}
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl ."'");
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '".$wsdl."'");
}
/**
@ -130,7 +144,7 @@ class WsdlDownloader
*
* @param string $file File URL/path
*
* @return boolean
* @return bool
*/
private function isRemoteFile($file)
{
@ -147,11 +161,9 @@ class WsdlDownloader
/**
* Resolves remote WSDL/XSD includes within the WSDL files.
*
* @param string $xml XML file
* @param string $cacheFilePath Cache file name
* @param boolean $parentFilePath Parent file name
*
* @return void
* @param string $xml XML file
* @param string $cacheFilePath Cache file name
* @param bool $parentFilePath Parent file name
*/
private function resolveRemoteIncludes($xml, $cacheFilePath, $parentFilePath = null)
{
@ -214,10 +226,10 @@ class WsdlDownloader
$urlParts = parse_url($base);
// combine base path with relative path
if (isset($urlParts['path']) && '/' === $relative{0}) {
if (isset($urlParts['path']) && '/' === $relative[0]) {
// $relative is absolute path from domain (starts with /)
$path = $relative;
} elseif (isset($urlParts['path']) && strrpos($urlParts['path'], '/') === (strlen($urlParts['path']) )) {
} elseif (isset($urlParts['path']) && strrpos($urlParts['path'], '/') === (strlen($urlParts['path']))) {
// base path is directory
$path = $urlParts['path'].$relative;
} elseif (isset($urlParts['path'])) {
@ -247,7 +259,7 @@ class WsdlDownloader
break;
}
$keyToDelete--;
--$keyToDelete;
}
unset($parts[$key]);

View File

@ -65,6 +65,5 @@ class XmlMimeFilter implements SoapRequestFilter
}
}
}
}
}

View File

@ -27,7 +27,7 @@ abstract class AbstractSoapBuilder
/**
* @return AbstractSoapBuilder
*/
static public function createWithDefaults()
public static function createWithDefaults()
{
$builder = new static();

View File

@ -25,24 +25,24 @@ class Cache
const TYPE_MEMORY = WSDL_CACHE_MEMORY;
const TYPE_DISK_MEMORY = WSDL_CACHE_BOTH;
static protected $types = array(
protected static $types = array(
self::TYPE_NONE,
self::TYPE_DISK,
self::TYPE_MEMORY,
self::TYPE_DISK_MEMORY,
);
static public function getTypes()
public static function getTypes()
{
return self::$types;
}
static public function isEnabled()
public static function isEnabled()
{
return self::iniGet('soap.wsdl_cache_enabled');
}
static public function setEnabled($enabled)
public static function setEnabled($enabled)
{
if (!in_array($enabled, array(self::ENABLED, self::DISABLED), true)) {
throw new \InvalidArgumentException();
@ -51,12 +51,12 @@ class Cache
self::iniSet('soap.wsdl_cache_enabled', $enabled);
}
static public function getType()
public static function getType()
{
return self::iniGet('soap.wsdl_cache');
}
static public function setType($type)
public static function setType($type)
{
if (!in_array($type, self::getTypes(), true)) {
throw new \InvalidArgumentException('The cache type has to be either Cache::TYPE_NONE, Cache::TYPE_DISK, Cache::TYPE_MEMORY or Cache::TYPE_DISK_MEMORY');
@ -65,12 +65,12 @@ class Cache
self::iniSet('soap.wsdl_cache', $type);
}
static public function getDirectory()
public static function getDirectory()
{
return self::iniGet('soap.wsdl_cache_dir');
}
static public function setDirectory($directory)
public static function setDirectory($directory)
{
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
@ -79,33 +79,33 @@ class Cache
self::iniSet('soap.wsdl_cache_dir', $directory);
}
static public function getLifetime()
public static function getLifetime()
{
return self::iniGet('soap.wsdl_cache_ttl');
}
static public function setLifetime($lifetime)
public static function setLifetime($lifetime)
{
self::iniSet('soap.wsdl_cache_ttl', $lifetime);
}
static public function getLimit()
public static function getLimit()
{
return self::iniGet('soap.wsdl_cache_limit');
}
static public function setLimit($limit)
public static function setLimit($limit)
{
self::iniSet('soap.wsdl_cache_limit', $limit);
}
static protected function iniGet($key)
protected static function iniGet($key)
{
return ini_get($key);
}
static protected function iniSet($key, $value)
protected static function iniSet($key, $value)
{
ini_set($key, $value);
}
}
}

View File

@ -90,4 +90,4 @@ class Classmap
$this->add($type, $classname);
}
}
}
}

View File

@ -44,4 +44,3 @@ class DateTimeTypeConverter implements TypeConverterInterface
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d\TH:i:sP'));
}
}

View File

@ -44,4 +44,3 @@ class DateTypeConverter implements TypeConverterInterface
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d'));
}
}

View File

@ -65,10 +65,8 @@ class MtomTypeConverter implements TypeConverterInterface, SoapKernelAwareInterf
$contentId = urldecode(substr($ref, 4));
if (null !== ($part = $this->soapKernel->getAttachment($contentId))) {
return $part->getContent();
} else {
return null;
}
}

View File

@ -28,5 +28,5 @@ interface SoapKernelAwareInterface
*
* @return void
*/
function setKernel(SoapKernel $soapKernel);
}
public function setKernel(SoapKernel $soapKernel);
}

View File

@ -61,10 +61,8 @@ class SwaTypeConverter implements TypeConverterInterface, SoapKernelAwareInterfa
$contentId = urldecode(substr($ref, 4));
if (null !== ($part = $this->soapKernel->getAttachment($contentId))) {
return $part->getContent();
} else {
return null;
}
}

View File

@ -74,10 +74,10 @@ class TypeConverterCollection
$typemap[] = array(
'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function($input) use ($converter) {
'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input);
},
'to_xml' => function($input) use ($converter) {
'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input);
},
);

View File

@ -24,14 +24,14 @@ interface TypeConverterInterface
*
* @return string
*/
function getTypeNamespace();
public function getTypeNamespace();
/**
* Get type name.
*
* @return string
*/
function getTypeName();
public function getTypeName();
/**
* Convert given XML string to PHP type.
@ -40,7 +40,7 @@ interface TypeConverterInterface
*
* @return mixed
*/
function convertXmlToPhp($data);
public function convertXmlToPhp($data);
/**
* Convert PHP type to XML string.
@ -49,5 +49,5 @@ interface TypeConverterInterface
*
* @return string
*/
function convertPhpToXml($data);
}
public function convertPhpToXml($data);
}

View File

@ -25,7 +25,7 @@ class Message
public function __construct($name)
{
$this->name = $name;
$this->parts = array();
$this->parts = [];
}
public function getName()
@ -48,13 +48,13 @@ class Message
return 0 === count($this->parts) ? true : false;
}
public function add($name, $phpType, $nillable = false)
public function add($name, $phpType, $nillable = false, $minOccurs = 1)
{
if ($phpType instanceof TypeInterface) {
$phpType = $phpType->getPhpType();
}
$this->parts[$name] = new Part($name, $phpType, $nillable);
$this->parts[$name] = new Part($name, $phpType, $nillable, $minOccurs);
return $this;
}

View File

@ -12,8 +12,6 @@
namespace BeSimple\SoapCommon\Definition;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
/**
* @author Francis Besset <francis.besset@gmail.com>
*/
@ -66,7 +64,7 @@ class Method
$this->input->add($name, $type);
}
public function setOutput($type)
public function setOutput($type, $name = 'return')
{
$this->output->add('return', $type);
}

View File

@ -20,11 +20,13 @@ class Part
protected $name;
protected $type;
protected $nillable;
protected $minOccurs;
public function __construct($name, $type, $nillable = false)
public function __construct($name, $type, $nillable = false, $minOccurs = 1)
{
$this->name = $name;
$this->type = $type;
$this->minOccurs = $minOccurs;
$this->setNillable($nillable);
}
@ -50,6 +52,16 @@ class Part
public function setNillable($nillable)
{
$this->nillable = (boolean) $nillable;
$this->nillable = (bool) $nillable;
}
public function setMinOccurs($minOccurs)
{
$this->minOccurs = $minOccurs;
}
public function getMinOccurs()
{
return $this->minOccurs;
}
}

View File

@ -175,4 +175,4 @@ class FilterHelper
$this->namespaces[$namespaceURI] = $prefix;
}
}
}
}

View File

@ -172,7 +172,8 @@ class Helper
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
@ -183,7 +184,9 @@ class Helper
// two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff)
);
}
@ -218,4 +221,4 @@ class Helper
return SOAP_1_1;
}
}
}
}

View File

@ -172,4 +172,4 @@ class MultiPart extends PartHeader
{
return 'urn:uuid:' . Helper::generateUUID();
}
}
}

View File

@ -184,4 +184,4 @@ class Parser
}
$part->setContent($content);
}
}
}

View File

@ -166,4 +166,4 @@ class Part extends PartHeader
{
return 'urn:uuid:' . Helper::generateUUID();
}
}
}

View File

@ -143,4 +143,4 @@ abstract class PartHeader
return $string;
}
}
}
}

View File

@ -47,7 +47,7 @@ abstract class SoapMessage
*
* @var array(string=>string)
*/
static protected $versionToContentTypeMap = array(
protected static $versionToContentTypeMap = array(
SOAP_1_1 => 'text/xml; charset=utf-8',
SOAP_1_2 => 'application/soap+xml; charset=utf-8'
);

View File

@ -22,5 +22,4 @@ use BeSimple\SoapCommon\SoapMessage;
*/
class SoapRequest extends SoapMessage
{
}
}

View File

@ -28,4 +28,4 @@ interface SoapRequestFilter
* @param SoapRequest $request SOAP request
*/
public function filterRequest(SoapRequest $request);
}
}

View File

@ -22,5 +22,4 @@ use BeSimple\SoapCommon\SoapMessage;
*/
class SoapResponse extends SoapMessage
{
}
}

View File

@ -28,4 +28,4 @@ interface SoapResponseFilter
* @param SoapResponse $response SOAP response
*/
public function filterResponse(SoapResponse $response);
}
}

View File

@ -78,4 +78,4 @@ class ClassmapTest extends \PHPUnit_Framework_TestCase
$this->setExpectedException('InvalidArgumentException');
$classmap1->addClassmap($classmap2);
}
}
}

View File

@ -51,4 +51,3 @@ class DateTimeTypeConverterTest extends \PHPUnit_Framework_TestCase
$this->assertNull($date);
}
}

View File

@ -49,4 +49,3 @@ class DateTypeConverterTest extends \PHPUnit_Framework_TestCase
$this->assertNull($date);
}
}

View File

@ -90,4 +90,4 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase
$this->setExpectedException('InvalidArgumentException');
$converters1->addCollection($converters2);
}
}
}

View File

@ -131,13 +131,13 @@ class MultiPartTest extends \PHPUnit_Framework_TestCase
$mp->addPart($p2);
$withoutMain = array(
trim($p2->getHeader('Content-ID'),'<>') => $p2,
trim($p2->getHeader('Content-ID'), '<>') => $p2,
);
$this->assertEquals($withoutMain, $mp->getParts());
$withMain = array(
trim($p1->getHeader('Content-ID'),'<>') => $p1,
trim($p2->getHeader('Content-ID'),'<>') => $p2,
trim($p1->getHeader('Content-ID'), '<>') => $p1,
trim($p2->getHeader('Content-ID'), '<>') => $p2,
);
$this->assertEquals($withMain, $mp->getParts(true));
}

View File

@ -5,7 +5,7 @@ namespace BeSimple\SoapCommon\Type\KeyValue;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;
class Boolean extends AbstractKeyValue
class BsBoolean extends AbstractKeyValue
{
/**
* @Soap\ComplexType("boolean")

View File

@ -5,7 +5,7 @@ namespace BeSimple\SoapCommon\Type\KeyValue;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;
class Float extends AbstractKeyValue
class BsFloat extends AbstractKeyValue
{
/**
* @Soap\ComplexType("float")

View File

@ -5,7 +5,7 @@ namespace BeSimple\SoapCommon\Type\KeyValue;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;
class Int extends AbstractKeyValue
class BsInt extends AbstractKeyValue
{
/**
* @Soap\ComplexType("int")

View File

@ -5,7 +5,7 @@ namespace BeSimple\SoapCommon\Type\KeyValue;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;
class String extends AbstractKeyValue
class BsString extends AbstractKeyValue
{
/**
* @Soap\ComplexType("string")

View File

@ -30,7 +30,7 @@ abstract class WsSecurityFilterClientServer
/**
* The date format to be used with {@link \DateTime}
*/
const DATETIME_FORMAT = 'Y-m-d\TH:i:s.000\Z';
const DATETIME_FORMAT = 'Y-m-d\TH:i:s.u\Z';
/**
* (X509 3.2.1) Reference to a Subject Key Identifier
@ -338,7 +338,6 @@ abstract class WsSecurityFilterClientServer
return XmlSecurityKey::factory($algorithm, $key, false, XmlSecurityKey::TYPE_PRIVATE);
} elseif (Helper::NS_WSS === $referencedNode->namespaceURI
&& 'BinarySecurityToken' == $referencedNode->localName) {
$key = XmlSecurityPem::formatKeyInPemFormat($referencedNode->textContent);
return XmlSecurityKey::factory(XmlSecurityKey::RSA_SHA1, $key, false, XmlSecurityKey::TYPE_PUBLIC);

View File

@ -113,4 +113,4 @@ class WsSecurityKey
{
return null !== $this->publicKey;
}
}
}

View File

@ -25,8 +25,7 @@
"ass/xmlsecurity": "~1.0"
},
"require-dev": {
"ext-mcrypt": "*",
"mikey179/vfsStream": "~1.0"
"mikey179/vfsstream": "~1.0"
},
"autoload": {
"psr-0": { "BeSimple\\SoapCommon": "" }

View File

@ -62,7 +62,7 @@ class SoapRequest extends CommonSoapRequest
} else {
$url .= 'http://';
}
$url .= isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : '';
$url .= isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) {
$url .= ":{$_SERVER['SERVER_PORT']}";
}

View File

@ -131,9 +131,7 @@ class SoapServer extends \SoapServer
/**
* Configure filter and type converter for SwA/MTOM.
*
* @param array &$options SOAP constructor options array.
*
* @return void
* @param array &$options SOAP constructor options array
*/
private function configureMime(array &$options)
{
@ -157,11 +155,11 @@ class SoapServer extends \SoapServer
}
$options['typemap'][] = array(
'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function($input) use ($converter) {
'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input);
},
'to_xml' => function($input) use ($converter) {
'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input);
},
);

View File

@ -33,7 +33,7 @@ class SoapServerBuilder extends AbstractSoapBuilder
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
static public function createWithDefaults()
public static function createWithDefaults()
{
return parent::createWithDefaults()
->withErrorReporting(false);
@ -197,4 +197,4 @@ class SoapServerBuilder extends AbstractSoapBuilder
throw new \InvalidArgumentException('The handler has to be configured!');
}
}
}
}

View File

@ -86,7 +86,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
$expires = $xpath->query($query, $security)->item(0);
if (null !== $expires) {
$expiresDatetime = \DateTime::createFromFormat(self::DATETIME_FORMAT, $expires->textContent, new \DateTimeZone('UTC'));
$expiresDatetime = \DateTime::createFromFormat(static::DATETIME_FORMAT, $expires->textContent, new \DateTimeZone('UTC'));
$currentDatetime = new \DateTime('now', new \DateTimeZone('UTC'));
if ($currentDatetime > $expiresDatetime) {
@ -170,7 +170,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
// init timestamp
$dt = new \DateTime('now', new \DateTimeZone('UTC'));
$createdTimestamp = $dt->format(self::DATETIME_FORMAT);
$createdTimestamp = $dt->format(static::DATETIME_FORMAT);
// create security header
$security = $filterHelper->createElement(Helper::NS_WSS, 'Security');
@ -182,7 +182,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
$timestamp->appendChild($created);
if (null !== $this->expires) {
$dt->modify('+' . $this->expires . ' seconds');
$expiresTimestamp = $dt->format(self::DATETIME_FORMAT);
$expiresTimestamp = $dt->format(static::DATETIME_FORMAT);
$expires = $filterHelper->createElement(Helper::NS_WSU, 'Expires', $expiresTimestamp);
$timestamp->appendChild($expires);
}

View File

@ -65,6 +65,5 @@ class XmlMimeFilter implements SoapResponseFilter
}
}
}
}
}

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