194 Commits

Author SHA1 Message Date
cc83e1e6db Add support for "overriden" routes 2019-08-06 11:59:02 +02:00
412e7f16c9 Reverted default definition style to RPC. 2019-08-06 11:58:51 +02:00
729a2bc8df Fix dumper in order to generate a valid WSDL 2019-08-06 11:58:35 +02:00
b8bf76aeb9 fixup! Update README, add back some instructions on how to use 2019-08-06 11:07:42 +02:00
a3d691261c Update README, add back some instructions on how to use 2019-08-06 11:04:18 +02:00
6cf62100a4 ext-mcrypt is not necessary and is not included in PHP anymore 2019-08-06 11:03:54 +02:00
2e9dc9a34d Fix issue that each method param overrides the initial input message. 2019-08-06 10:57:16 +02:00
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
ec0004ea36 Revert "Fix error handling"
This reverts commit ef81da77ea.
2019-08-06 10:28:55 +02:00
00101ff7fb Restore package name after merging back changes of cocciagialla fork 2019-08-06 10:26:19 +02:00
ef81da77ea Fix error handling 2019-07-03 01:08:36 +02:00
54e9e0ed05 Remove SOAP-ENC 2019-06-27 13:40:00 +02:00
679b44ba13 Use encoded instead of literal 2019-06-27 13:08:26 +02:00
a7a49b793a Add minOccurs and maxOccurs into wsdl dumper 2019-06-26 19:22:09 +02:00
d1f5c1f674 Remove from response the nillable elements. Fix namespace declaration in the xml response 2019-06-26 19:03:56 +02:00
fea1093bed Remove from response the nillable elements. Fix namespace declaration in the xml response 2019-06-26 18:53:59 +02:00
9fc58e4388 Replace SOAP-ENV with soap as soap-envelope ns prefix 2019-06-24 19:05:43 +02:00
a7c610b767 Add hexBinary type 2019-04-15 18:20:57 +02:00
2b8f75b4ae Fix wsdl for array complex type 2019-04-11 10:33:17 +02:00
6718703ba5 Add headers binder for document 2019-04-10 07:31:37 +02:00
f9f47b913d Add base64Binary type 2019-04-10 07:30:54 +02:00
ca4991a9f6 Fix location url from relative to absolute 2019-04-10 07:30:25 +02:00
cdf77dacd8 Fix input naming 2019-04-10 07:29:27 +02:00
7802a0d19f Fix Dumper. Each complext type is now wrapped inside container element tag 2019-04-10 07:28:07 +02:00
c4118855de Fix document literal binder for request and response 2019-04-10 07:22:34 +02:00
2771991fc0 Set document instead of rpc as default binding style 2019-04-10 07:21:51 +02:00
ceb69d97c3 Fix binding name and soapAction attribute on wsdl 2019-04-10 07:20:49 +02:00
19326bccdd Add .idea to ignore 2019-04-10 07:20:07 +02:00
22bde386ab Fix composer json 2019-04-02 15:15:56 +02:00
2d36e5f060 Fix compatibility with SF4 + Other fixes 2019-04-02 14:58:41 +02:00
873dc0ae08 Replace DefinitionDecorator with ChildDefinition 2019-03-14 04:53:26 +01:00
0e24ffe23d Alias dev-master 2019-03-14 04:31:19 +01:00
d0f53bc806 pdate to SF4 2019-03-14 03:24:20 +01:00
0cb00e71b5 Change package name 2019-03-14 03:05:52 +01:00
cc888bf168 Deprecated method change 2019-02-13 10:02:20 +01:00
bb95a6cb45 Response xml format change support with backward compatibility 2019-02-11 12:28:54 +01:00
3f2a99adf6 Array support change
Support of mapping xml attributes
2019-02-11 12:28:54 +01:00
ad93b5ca49 PHP 7 compatibility 2019-02-11 11:55:54 +01:00
cdeab44c2c Like this, DATETIME_FORMAT could be overriden
Partial Fix BeSimple#68
2019-02-11 11:45:50 +01:00
e046be22eb Date semantics must support milliseconds for better interoperability
Fix BeSimple#68
2019-02-11 11:39:35 +01:00
b10b5431e5 Back to original name 2019-02-11 11:33:27 +01:00
408d88f164 Readme typo 2018-04-06 12:07:55 +02:00
0e4034a093 Merge tag '0.3.0' into develop
Compatibility Symfony 3
2018-04-06 12:02:37 +02:00
fd64676312 Merge branch 'release/0.3.0' 2018-04-06 12:02:15 +02:00
4d66d072ec Bump version 0.3.0 2018-04-06 12:01:48 +02:00
735f6a5826 README update 2018-04-06 11:58:10 +02:00
498012697d get path 2018-04-06 11:32:08 +02:00
b96b65cc49 ComtainerAware -> Interface 2018-04-06 11:29:08 +02:00
0748b23630 Symfony 2 fixes 2018-04-06 11:21:50 +02:00
63111261e7 Restart fomr 0.2 2018-04-06 11:18:36 +02:00
2b91f94b8d Ignore composer.phar 2018-04-06 11:06:18 +02:00
1af0828b15 Revert whole code to legacy 2018-04-06 10:58:45 +02:00
0ca2fe1fd5 getCurrentRequest 2018-04-06 10:53:16 +02:00
fd923e032e cache->getPath 2018-04-06 10:50:13 +02:00
e32514abe4 Add Classmap (common) 2018-04-06 10:43:58 +02:00
7322bfefd0 Add Classmap 2018-04-06 10:40:03 +02:00
e232b1d8b9 ContainerAware -> ContainerAwareInterface 2018-04-06 10:20:53 +02:00
1b87b4d212 Fix pattern->path 2018-04-06 10:16:21 +02:00
ae746087e6 Test With Legacy bundle 2018-04-06 10:12:08 +02:00
9312e4af6a Revert "Test"
This reverts commit c3da1d545a.
2018-04-06 10:09:28 +02:00
c3da1d545a Test 2018-04-06 09:58:43 +02:00
ad2bd7bc7a Rename fork 2018-04-04 11:52:49 +02:00
e58927469c Run mock server in each SoapClient test case & unit test fixed 2018-02-06 00:38:35 +01:00
45cce3a41c Integration test fixed 2018-02-06 00:31:06 +01:00
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
69a7005c35 Get basic bundle configuration working for SoapClient with Symfony 3.x. 2018-01-18 11:40:02 -05:00
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
7ab8771989 Merge pull request #7 from tuscanicz/develop
Recognizing mime boundary according to RFC
2017-08-23 16:11:19 +02:00
d68c25daad Recognizing mime boundary according to RFC 2017-08-23 15:30:36 +02:00
6e117940a3 ResolveRemoteIncludes fix: RelativePathResolver was not used in XmlDomDocumentImportReplacer 2017-07-24 10:11:13 +02:00
0c47f5a8d4 RelativePathResolver did not work correctly for ../directories 2017-07-21 14:49:42 +02:00
75a0489cce Merge remote-tracking branch 'remotes/origin/develop' 2017-07-21 10:31:28 +02:00
de5d6a2647 SoapClientOptions now contains resolve remove includes option for WSDL downloader 2017-07-21 10:21:50 +02:00
6970b7bbef WsdlDownloader fix: remote includes now work correctly with relative URLs & tests added 2017-07-18 18:52:52 +02:00
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
668f2dd258 PhpUnit - code coverage whitelisted 2017-06-13 13:06:58 +02:00
a8bc834077 Mime/PartHeaders now handle both Content-ID and Content-id according to W3 specs 2017-06-12 15:14:28 +02:00
f74e4b08ce Mime Parser: throws Exception with MimePartMessage contents 2017-06-12 00:28:27 +02:00
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
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
c82288d641 Travis deployment fixed 2017-06-07 16:23:47 +02:00
bb20882ade Readme updated 2017-06-07 16:18:46 +02:00
2264e329a1 Added phing for running tests & fixed issues in order to pass the tests 2017-06-07 15:50:04 +02:00
b9e36b4900 Fix notice: attribute soapClientOptions defined in Trait and Client class 2017-06-05 10:50:53 +02:00
d495f22413 SoapFaultWithTracingData now provides request / response information from Server SoapFaults 2017-05-30 18:29:51 +02:00
8db9b374e4 SoapFault handling refactored: client now returns server fault codes + more details in message 2017-05-26 10:53:41 +02:00
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
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
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
b45202f40a Project composer description update 2017-04-26 13:00:40 +02:00
ab83642f06 Parser fix: single line MimeMessages are now parsed correctly 2017-04-06 15:51:29 +02:00
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
311f9e6d08 Readme update: better examples added 2017-03-15 11:23:21 +01:00
e67d5aa84b Readme updated 2017-03-15 10:48:23 +01:00
d3023b1a5a UnitTests are now located in tests directory & tiny improvements 2017-03-15 10:25:48 +01:00
21d705bbfa SoapClient custom endpoint location & connection keep alive configuration added & tests updated 2017-03-03 11:11:44 +01:00
0e2c33faf8 Support of older PHP versions removed: MimeFilter does not sanitize PHP 5.4.x error 2017-02-22 12:23:24 +01:00
cf6e147c26 Merge remote-tracking branch 'remotes/origin/develop' 2017-02-18 00:14:21 +01:00
f276a30a47 Curl/WsdlGenerator - better error handling 2017-02-18 00:13:02 +01:00
4edc46e67f Parser fix - MimeMessages with CRLF caused iconv_mime_decode throwing Exceptions 2017-02-17 15:06:06 +01:00
a76526a5b6 DEFAULT_CONNECTION_TIMEOUT default value increased to 120 2017-02-17 11:20:09 +01:00
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
5c0bf914e3 Unused SoapClientNativeDataTransferObject removed 2017-02-17 03:36:16 +01:00
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
e1b50ce914 SoapClient::__soapCall() must be compatible with \SoapClient::__soapCall() fix 2017-02-17 00:26:01 +01:00
68b41acc46 SoapClient - WSDL download fixes 2017-02-17 00:14:05 +01:00
30a9707c59 Merge remote-tracking branch 'remotes/origin/develop' 2017-02-14 16:48:58 +01:00
aee034791e SoapClient large refactoring & tests update 2017-02-14 16:01:39 +01:00
00ddf149b0 Passing SOAP fault with detail 2016-11-29 18:55:55 +01:00
476813e9bb MIME parts now contain only LF (was CRLF) 2016-11-29 18:55:55 +01:00
f57239ad0d MultiPart Boundary generator changed 2016-11-24 15:18:00 +01:00
10caf27da3 MultiPart ContentId is now in different format 2016-11-24 15:00:46 +01:00
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
1224f5f40f Content-Location added for attachment parts 2016-11-24 12:45:17 +01:00
f4a4619fe6 Handling SoapRequests/SoapResponse with attachments fix 2016-11-24 11:04:57 +01:00
052ab20d67 tiny bugfixes 2016-11-11 16:04:44 +01:00
dd7b6904b6 SoapOptions moved 2016-11-09 17:05:43 +01:00
c4d993585f SoapServer now handles get WSDL requests 2016-11-09 13:43:18 +01:00
bd1fbf9cfc SoapServer::handle() has to be compatible with \SoapServer 2016-11-09 12:08:32 +01:00
5fbcfb3e22 AttachmentsHandlerInterface refactored 2016-11-08 18:31:28 +01:00
84c37b1d24 Soap server with attachments refactoring 2016-11-08 15:42:52 +01:00
8d033f9afc SoapResponse is a product of SoapResponseFactory, small refactorings 2016-11-02 16:08:21 +01:00
bf494a42b5 MimeFilters are now stateless 2016-11-02 09:55:12 +01:00
969709cae5 Large refactoring of SoapKernel 2016-11-01 18:13:23 +01:00
155aa029ce SoapRequest is now SoapRequestFactory product 2016-11-01 16:23:21 +01:00
3c0f731086 SoapOptions cache dir introduced + SoapOptionsBuilder - new methods added 2016-11-01 09:24:41 +01:00
374c64538a remove useless SoapClientBuilder 2016-10-31 14:12:35 +01:00
4d7894b66e Composer info updated 2016-10-27 16:38:53 +02:00
0a157748a8 Large refactoring removing states, abstract magic, vague fluent interfaces 2016-10-27 16:24:44 +02:00
c4a9b58b08 Use request_stack service instead of deprecated request service 2016-01-11 16:28:20 +11:00
fc15bf36ab Call getPath() instead of string casting 2016-01-11 16:28:05 +11:00
8462233a08 Update FlattenException use statements 2016-01-11 16:20:13 +11:00
03227295f6 Use ContainerAwareTrait and ContainerAwareInterface 2016-01-11 16:09:42 +11:00
f285adfa14 Use path attribute rather than pattern 2016-01-11 16:06:22 +11:00
2ecdbe9714 Change package name and description 2016-01-08 11:47:15 +11:00
e5c54164c1 Support Symfony 3.* 2016-01-08 11:42:56 +11:00
27ebf0fbce Merge remote-tracking branch 'origin/0.2' 2015-06-01 16:04:32 +02:00
855e382590 [SoapBundle] Fixed service definition with factory 2015-06-01 16:04:29 +02:00
2974a4f838 Stop support of Symfony <2.6 2015-06-01 16:04:24 +02:00
fb56d51bd8 fixup! [SoapBundle] Set _format route to xml 2015-03-27 16:07:42 +01:00
f2a8a7ebb3 Merge branch '0.2' 2014-08-18 14:20:19 +02:00
7a9119cef1 [SoapBundle] Added configuration to configure client proxy 2014-08-18 13:54:19 +02:00
1a7f60b679 [SoapClient] Added proxy authentication option in SoapClientBuilder
Fixed #47
2014-08-18 11:45:53 +02:00
70db0c42fd [SoapClient] Renamed proxy_user to proxy_login option to keep compatibility with SoapClient of PHP 2014-08-18 10:58:40 +02:00
960c9f557a [SoapClient] Fixed typo for proxy options
Fixed #46
2014-08-18 10:31:20 +02:00
33d641de4e [SoapClient] Fixed tests if proxy exists in environment variables 2014-08-18 10:29:49 +02:00
bbd4c26134 Merge branch '0.2' 2014-08-16 15:48:45 +02:00
29170576c2 [Doc] Added documentation for SoapClient 2014-08-15 21:18:24 +02:00
50ab5a93ad [SoapBundle] Update the cache dir 2014-08-15 19:46:23 +02:00
1290573285 [SoapBundle] Add a hack to load BeSimpleSoap cache with a client 2014-08-15 19:45:21 +02:00
f5675f6ece [SoapBundle] Set cache informations even though it is disabled 2014-08-15 19:43:31 +02:00
15b208d861 Replaced cli_webserver_workaround client option by a check of CONTENT_TYPE AND HTTP_CONTENT_TYPE entry in SERVER superglobal 2014-08-14 21:40:13 +02:00
294a9fe90e Stop support of Symfony <2.3 2014-08-14 15:02:52 +02:00
313840d5a4 Revert "[SoapClient] [Tests] Down required version of symfony/filesystem vendor"
This reverts commit 726ee89936.

Conflicts:
	composer.json
	src/BeSimple/SoapClient/composer.json
2014-08-14 14:57:00 +02:00
8e4d8b0300 Updated BeSimpleSoap vendor requierement to 0.3 2014-08-14 14:56:39 +02:00
621b2080e0 Updated version to 0.3 2014-08-14 14:21:49 +02:00
fe67cff5ff Merge branch 'fixed_tests' 2014-08-14 13:39:12 +02:00
e676eb0432 [composer] Used a stable version of vfsStream 2014-08-14 13:33:32 +02:00
fd402731af Fixed travis configuration 2014-08-14 13:20:09 +02:00
f5d6f5e759 Updated travis 2014-08-14 13:06:18 +02:00
726ee89936 [SoapClient] [Tests] Down required version of symfony/filesystem vendor 2014-08-14 13:06:18 +02:00
36a368e695 [composer] Removed dev minimum-stability 2014-08-14 13:06:18 +02:00
e2de214ea5 [SoapClient] [Tests] Removed uploaded file 2014-08-14 13:06:18 +02:00
3cfeea8371 [SoapClient] [Tests] Fixed typo 2014-08-14 13:06:18 +02:00
c24e8775bf [SoapClient] Add possiblity to disable proxy if present in environment variable 2014-08-14 13:05:50 +02:00
b3c6353af8 [composer] Removed dev minimum-stability 2014-08-14 13:05:50 +02:00
10bba6a3bd [Test] Force replace unziped file for axis server 2014-08-13 22:08:17 +02:00
a122f2a0f6 [SoapBundle] Skipped test for SoapRequest 2014-08-13 22:02:46 +02:00
8d13d2dd5c [Doc] Add missing methods 2014-08-13 06:57:03 +02:00
1c1cd377f1 Merge branch 'ch3ric-fix-doc' 2014-08-13 06:55:07 +02:00
1efa348ae5 Merge branch 'fix-doc' of https://github.com/ch3ric/BeSimpleSoap into ch3ric-fix-doc 2014-08-13 06:55:01 +02:00
ccc4d57501 Merge pull request #42 from mremi/handle-request-options
Handled additional request options
2014-07-10 16:16:27 +02:00
740f146bad Handled additional request options 2014-07-01 15:47:46 +02:00
5e8e669299 Fix Doc 2014-05-25 16:48:26 +02:00
e4cb612aed Created a client classmap even when it is empty 2014-04-30 10:54:07 +02:00
59ea6b1ce0 Merge pull request #33 from borissamardzija/master
Update Curl class to support CURLOPT_CAINFO and CURLOPT_CAPATH options
2014-04-25 13:36:04 +02:00
7bb849e394 Update Curl class to support CURLOPT_CAINFO and CURLOPT_CAPATH options 2014-04-25 11:16:34 +02:00
02722eae8f Merge pull request #32 from mremi/filter-request-headers
Added method to tweak HTTP headers of request
2014-04-24 17:22:00 +02:00
b7581f29b0 Removed reference to return an array of HTTP headers 2014-04-24 09:29:58 +02:00
dc6e1e0889 Merge pull request #31 from mremi/http-auth
Added extra option to configure HTTP authentication
2014-04-24 08:38:03 +02:00
f986400dc2 Merge pull request #30 from mremi/method-visibility
Updated visibility from private to protected
2014-04-24 08:36:23 +02:00
67410805ba Added method to tweak HTTP headers of request 2014-04-22 22:29:11 +02:00
2ae7515294 Added extra option to configure HTTP authentication 2014-04-22 22:05:04 +02:00
cdfc3cd5bd Updated visibility from private to protected 2014-04-22 21:53:14 +02:00
9ac755d86e [SoapBundle] Set _format route to xml 2013-12-13 15:25:20 +01:00
321dcf3058 [SoapBundle] Set wsdl request type only if the "wsdl" parameter in present in URL 2013-12-13 11:24:25 +01:00
3a2b8e32ee [SoapBundle] Enhanced SoapFault management 2013-12-13 08:26:18 +01:00
fd5154a469 Fixed typo 2013-12-10 15:25:09 +01:00
188f282a87 [SoapWsdl] Specify an empty message if the input is empty 2013-12-10 15:25:09 +01:00
f9e230400d [SoapBundle] Fixed RpcLiteralRequestMessageBinderTest 2013-12-08 00:27:33 +01:00
1b4e262c60 [SoapBundle] Simplified conditional statement 2013-12-08 00:25:20 +01:00
60e3714602 [SoapBundle][SoapCommon] Removed unused TypeRepository in Definition\Method classes 2013-12-08 00:23:30 +01:00
1e82d7fdd7 Fix WSDL schema stylesheet including 2013-12-07 19:55:33 +01:00
77 changed files with 1096 additions and 392 deletions

2
.gitignore vendored
View File

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

View File

@ -1,19 +1,19 @@
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=dev-master
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION="dev-master symfony/debug:~2.8@dev symfony/http-kernel:~2.8@dev"
before_script:
- composer require symfony/http-foundation:${SYMFONY_VERSION} --no-interaction --prefer-source
- phpenv config-add myphp.ini
- composer self-update
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
- composer update --no-interaction --prefer-source
- ./src/BeSimple/SoapClient/Tests/bin/phpwebserver.sh
- ./src/BeSimple/SoapClient/Tests/bin/axis.sh
@ -22,4 +22,4 @@ script:
matrix:
allow_failures:
- env: SYMFONY_VERSION=dev-master
- 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,12 +20,12 @@
}
],
"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",
"symfony/framework-bundle": "~3.4|~4.0",
"symfony/twig-bundle": "~3.4|~4.0",
"zendframework/zend-mime": "2.1.*"
},
"replace": {
@ -33,21 +33,21 @@
"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": "dev-master",
"mikey179/vfsstream": "~1.6.5",
"symfony/filesystem": "~2.3",
"symfony/process": "~2.3"
"symfony/process": "~2.3",
"phpunit/phpunit": "^5.7"
},
"autoload": {
"psr-0": { "BeSimple\\": "src/" }
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"
"dev-master": "master-dev"
}
}
}

View File

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

View File

@ -25,17 +25,15 @@ class Cache
BaseCache::setEnabled($isEnabled);
if (BaseCache::ENABLED == BaseCache::isEnabled()) {
BaseCache::setType($type);
BaseCache::setDirectory($directory);
BaseCache::setType($type);
BaseCache::setDirectory($directory);
if (null !== $lifetime) {
BaseCache::setLifetime($lifetime);
}
if (null !== $lifetime) {
BaseCache::setLifetime($lifetime);
}
if (null !== $limit) {
BaseCache::setLimit($limit);
}
if (null !== $limit) {
BaseCache::setLimit($limit);
}
}
}
}

View File

@ -15,20 +15,27 @@ namespace BeSimple\SoapBundle\Controller;
use BeSimple\SoapBundle\Handler\ExceptionHandler;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use Symfony\Component\DependencyInjection\ContainerAware;
use BeSimple\SoapBundle\WebServiceContext;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
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
*/
@ -59,11 +66,12 @@ class SoapWebServiceController extends ContainerAware
*/
public function callAction($webservice)
{
/** @var WebServiceContext $webServiceContext */
$webServiceContext = $this->getWebServiceContext($webservice);
$this->serviceBinder = $webServiceContext->getServiceBinder();
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request'));
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request_stack')->getCurrentRequest());
$this->soapServer = $webServiceContext
->getServerBuilder()
->withSoapVersion11()
@ -82,21 +90,29 @@ 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 ($result === null) {
$routeName = '_webservice_call';
}
$response = new Response($this->getWebServiceContext($webservice)->getWsdlFileContent(
$this->container->get('router')->generate(
'_webservice_call',
$routeName,
array('webservice' => $webservice),
true
UrlGeneratorInterface::ABSOLUTE_URL
)
));
$query = $this->container->get('request')->query;
if (!$query->has('wsdl') && !$query->has('WSDL')) {
$this->container->get('request')->setRequestFormat('xml');
/** @var Request $request */
$request = $this->container->get('request_stack')->getCurrentRequest();
$query = $request->query;
if ($query->has('wsdl') || $query->has('WSDL')) {
$request->setRequestFormat('wsdl');
}
return $response;
@ -119,25 +135,39 @@ 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, array(
'status_code' => $code,
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
'exception' => $exception,
'logger' => $logger,
));
$server = $this
->container
->get(sprintf('besimple.soap.context.%s', $webservice))
->getServerBuilder()
->withHandler(new ExceptionHandler($exception, $details))
$handler = new ExceptionHandler($exception, $details);
if ($soapFault = $request->query->get('_besimple_soap_fault')) {
$handler->setSoapFault($soapFault);
// Remove parameter from query because cannot be Serialized in Logger
$request->query->remove('_besimple_soap_fault');
}
$server = SoapServerBuilder::createWithDefaults()
->withWsdl(__DIR__.'/../Handler/wsdl/exception.wsdl')
->withWsdlCacheNone()
->withHandler($handler)
->build()
;
ob_start();
$server->handle($request->getContent());
$server->handle(
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://besim.pl/soap/exception/1.0/">'.
'<soapenv:Header/>'.
'<soapenv:Body>'.
'<ns:exception />'.
'</soapenv:Body>'.
'</soapenv:Envelope>'
);
return new Response(ob_get_clean());
}
@ -221,7 +251,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

@ -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.
@ -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])) {
@ -98,18 +103,31 @@ class BeSimpleSoapExtension extends Extension
}
}
$proxy = $options['proxy'];
if (false !== $proxy['host']) {
if (null !== $proxy['auth']) {
if ('basic' === $proxy['auth']) {
$proxy['auth'] = \CURLAUTH_BASIC;
} elseif ('ntlm' === $proxy['auth']) {
$proxy['auth'] = \CURLAUTH_NTLM;
}
}
$definition->addMethodCall('withProxy', array(
$proxy['host'], $proxy['port'],
$proxy['login'], $proxy['password'],
$proxy['auth']
));
}
if (isset($defOptions['cache_type'])) {
$defOptions['cache_type'] = $this->getCacheType($defOptions['cache_type']);
}
$definition->replaceArgument(1, $defOptions);
if (!empty($options['classmap'])) {
$classmap = $this->createClientClassmap($client, $options['classmap'], $container);
$definition->replaceArgument(2, new Reference($classmap));
} else {
$definition->replaceArgument(2, null);
}
$classmap = $this->createClientClassmap($client, $options['classmap'], $container);
$definition->replaceArgument(2, new Reference($classmap));
$this->createClient($client, $container);
}
@ -117,22 +135,31 @@ 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);
$definition->setMethodCalls(array(
array('set', array($classmap)),
));
if (!empty($classmap)) {
$definition->setMethodCalls(array(
array('set', array($classmap)),
));
}
return sprintf('besimple.soap.classmap.%s', $client);
}
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 (3 === Kernel::MAJOR_VERSION) {
$definition->setFactory(array(
new Reference(sprintf('besimple.soap.client.builder.%s', $client)),
'build'
));
} else {
$definition->setFactoryService(sprintf('besimple.soap.client.builder.%s', $client));
}
}
private function createWebServiceContext(array $config, ContainerBuilder $container)
@ -141,7 +168,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'])) {
@ -150,6 +177,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

@ -24,6 +24,7 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class Configuration
{
private $cacheTypes = array('none', 'disk', 'memory', 'disk_memory');
private $proxyAuth = array('basic', 'ntlm');
/**
* Generates the configuration tree.
@ -85,12 +86,33 @@ class Configuration
->scalarNode('cache_type')
->validate()
->ifNotInArray($this->cacheTypes)
->thenInvalid(sprintf('The cache type has to be either %s', implode(', ', $this->cacheTypes)))
->thenInvalid(sprintf('The cache type has to be either: %s', implode(', ', $this->cacheTypes)))
->end()
->end()
->arrayNode('classmap')
->useAttributeAsKey('name')->prototype('scalar')->end()
->end()
->arrayNode('proxy')
->info('proxy configuration')
->addDefaultsIfNotSet()
->beforeNormalization()
->ifTrue(function ($v) { return !is_array($v); })
->then(function ($v) { return array('host' => null === $v ? false : $v); })
->end()
->children()
->scalarNode('host')->defaultFalse()->end()
->scalarNode('port')->defaultValue(3128)->end()
->scalarNode('login')->defaultNull()->end()
->scalarNode('password')->defaultNull()->end()
->scalarNode('auth')
->defaultNull()
->validate()
->ifNotInArray($this->proxyAuth)
->thenInvalid(sprintf('The proxy auth has to be either: %s', implode(', ', $this->proxyAuth)))
->end()
->end()
->end()
->end()
->end()
->end()
->end()

View File

@ -51,7 +51,9 @@ class SoapExceptionListener extends ExceptionListener
}
$request = $event->getRequest();
if ('soap' !== $request->getRequestFormat()) {
if (!in_array($request->getRequestFormat(), array('soap', 'xml'))) {
return;
} elseif ('xml' === $request->getRequestFormat() && '_webservice_call' !== $request->attributes->get('_route')) {
return;
}
@ -67,12 +69,18 @@ class SoapExceptionListener extends ExceptionListener
// hack to retrieve the current WebService name in the controller
$request->query->set('_besimple_soap_webservice', $webservice);
$exception = $event->getException();
if ($exception instanceof \SoapFault) {
$request->query->set('_besimple_soap_fault', $exception);
}
parent::onKernelException($event);
}
public static function getSubscribedEvents()
{
return array(
// Must be called before ExceptionListener of HttpKernel component
KernelEvents::EXCEPTION => array('onKernelException', -64),
);
}

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>
@ -23,6 +23,7 @@ class ExceptionHandler
{
protected $exception;
protected $details;
protected $soapFault;
public function __construct(FlattenException $exception, $details = null)
{
@ -30,8 +31,17 @@ class ExceptionHandler
$this->details = $details;
}
public function setSoapFault(\SoapFault $soapFault)
{
$this->soapFault = $soapFault;
}
public function __call($method, $arguments)
{
if (isset($this->soapFault)) {
throw $this->soapFault;
}
$code = $this->exception->getStatusCode();
throw new ReceiverSoapFault(

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://besim.pl/soap/exception/1.0/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Exception" targetNamespace="http://besim.pl/soap/exception/1.0/">
<portType name="ExceptionPortType">
<operation name="exception">
<input message="tns:empty"/>
<output message="tns:empty"/>
</operation>
</portType>
<message name="empty" />
<binding name="ExceptionBinding" type="tns:ExceptionPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="exception">
<soap:operation soapAction="http://besim.pl/soap/exception/1.0/exception"/>
<input>
<soap:body use="literal" namespace="http://besim.pl/soap/exception/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="literal" namespace="http://besim.pl/soap/exception/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="ExceptionService">
<port name="ExceptionPort" binding="tns:ExceptionBinding">
<soap:address location="http://localhost/soap/Exception"/>
</port>
</service>
</definitions>

View File

@ -16,6 +16,7 @@
</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" factory-service="besimple.soap.client.builder" factory-method="build" class="%besimple.soap.client.builder.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" pattern="/{webservice}">
<route id="_webservice_call" path="/{webservice}" methods="POST">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Call</default>
<default key="_format">soap</default>
<requirement key="_method">POST</requirement>
<default key="_format">xml</default>
</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">wsdl</default>
<requirement key="_method">GET</requirement>
<default key="_format">xml</default>
</route>
</routes>

View File

@ -12,7 +12,7 @@
<service id="besimple.soap.cache" class="%besimple.soap.cache.class%">
<argument>%kernel.debug%</argument>
<argument>%besimple.soap.cache.type%</argument>
<argument>%besimple.soap.cache.dir%/php</argument>
<argument>%besimple.soap.cache.dir%/cache</argument>
<argument>%besimple.soap.cache.lifetime%</argument>
<argument>%besimple.soap.cache.limit%</argument>
</service>

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" />
@ -44,6 +44,7 @@
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.rpcliteral.class%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.rpcliteral.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.rpcliteral.class%</argument>
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
</argument>
<argument type="service" id="besimple.soap.cache" />
</service>
@ -58,6 +59,7 @@
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.documentwrapped.class%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.documentwrapped.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.documentwrapped.class%</argument>
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
</argument>
<argument type="service" id="besimple.soap.cache" />
</service>
@ -94,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

@ -33,4 +33,8 @@ SoapServer
SoapClient
----------
Coming soon.
.. toctree::
:maxdepth: 1
:numbered:
soapclient/configuration

View File

@ -0,0 +1,158 @@
Configuration
=============
Client configuration
--------------------
Configure your first client in your config file:
.. code-block:: yaml
# app/config/config.yml
be_simple_soap:
clients:
DemoApi:
# required
wsdl: http://localhost/app_dev.php/ws/DemoApi?wsdl
# classmap (optional)
classmap:
type_name: "Full\Class\Name"
# proxy (optional)
proxy:
host: proxy.domain.name # required to enable proxy configuration
port: 3128
login: ~
password: ~
auth: ~ # can be 'basic' or 'ntlm'
Using client
------------
.. code-block:: php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DemoController extends Controller
{
public function helloAction($name)
{
// The client service name is `besimple.soap.client.demoapi`:
// `besimple.soap.client.`: is the base name of your client
// `demoapi`: is the name specified in your config file converted to lowercase
$client = $this->container->get('besimple.soap.client.demoapi');
// call `hello` method on WebService with the string parameter `$name`
$helloResult = $client->hello($name);
return $this->render('AcmeDemoBundle:Demo:hello.html.twig', array(
'hello' => $helloResult,
));
}
}
Classmap
--------
Configuration
~~~~~~~~~~~~~
.. code-block:: yaml
# app/config/config.yml
be_simple_soap:
clients:
DemoApi:
# ...
classmap:
User: Acme\DemoBundle\Api\UserApi
# add other type_name: classname
UserApi class
~~~~~~~~~~~~~
.. code-block:: php
namespace Acme\DemoBundle\Api;
class UserApi
{
private $username;
private $firstname;
private $lastname;
public function __construct($username)
{
$this->username = $username;
}
public function getFirstname()
{
return $this->firstname;
}
public function getLastname()
{
return $this->lastname;
}
}
Usage
~~~~~
.. code-block:: php
namespace Acme\DemoBundle\Controller;
use Acme\DemoBundle\Api\UserApi;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DemoController extends Controller
{
public function userAction($username)
{
// The client service name is `besimple.soap.client.demoapi`:
// `besimple.soap.client.`: is the base name of your client
// `demoapi`: is the name specified in your config file converted to lowercase
$client = $this->container->get('besimple.soap.client.demoapi');
// call `getUser` method on WebService with an instance of UserApi
// if the `getUserByUsername` method return a `User` type then `$userResult` is an instance of UserApi
$userResult = $client->getUserByUsername($username);
return $this->render('AcmeDemoBundle:Demo:user.html.twig', array(
'user' => $userResult,
));
}
}
Without classmap configuration the `$userResult` is an instance of `stdClass`:
.. code-block:: text
object(stdClass)#5561 (3) {
["username"]=>
string(6) "FooBar"
["firstname"]=>
string(3) "Foo"
["lastname"]=>
string(3) "Bar"
}
With classmap configuration the `$userResult` is an instance of `Acme\DemoBundle\Api\UserApi`:
.. code-block:: text
object(Acme\DemoBundle\Api\UserApi)#208 (3) {
["username":"Acme\DemoBundle\Api\UserApi":private]=>
string(6) "FooBar"
["firstname":"Acme\DemoBundle\Api\UserApi":private]=>
string(3) "Foo"
["lastname":"Acme\DemoBundle\Api\UserApi":private]=>
string(3) "Bar"
}

View File

@ -47,9 +47,9 @@ Controller
/**
* @Soap\Method("sendAssocArray")
* @Soap\Param("assocArray", phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]")
* @Soap\Return(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]")
* @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]")
*/
public function assocArrayOfStringAction(array $assocArray)
public function sendAssocArrayOfStringAction(array $assocArray)
{
// The $assocArray it's a real associative array
// var_dump($assocArray);die;
@ -97,3 +97,4 @@ How to create my Associative Array?
'user2' => new User('user2', 'user2@user.com'),
);
}
}

View File

@ -86,6 +86,16 @@ You can expose only the properties (public, protected or private) of a complex t
*/
private $newsletter;
/**
* @Soap\ComplexType("date")
*/
private $createdAt:
/**
* @Soap\ComplexType("datetime")
*/
private $updatedAt;
public function getId()
{
return $this->id;
@ -128,7 +138,27 @@ You can expose only the properties (public, protected or private) of a complex t
public function setNewsletter($newsletter)
{
$this->newletter = (Boolean) $newsletter
$this->newletter = (Boolean) $newsletter;
}
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
}
public function getUpdatedAt()
{
return this->updatedAt;
}
public function setUpdatedAt(\DateTime $updatedAt)
{
$this->updatedAt = $updatedAt;
}
}

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,13 +11,14 @@
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) {
throw new \InvalidArgumentException();
@ -26,10 +27,10 @@ class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterfa
$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

@ -55,7 +55,8 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$isArray = true;
$array = array();
$type = $this->typeRepository->getType($type->get('item')->getType());
$phpType = substr($type->getPhpType(), 0, strlen($type->getPhpType()) - 2);
$type = $this->typeRepository->getType($phpType);
}
// @TODO Fix array reference
@ -78,6 +79,21 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$array = $assocArray;
}
}
if (is_array($message)) {
foreach ($message as $complexType) {
$array[] = $this->checkComplexType($phpType, $complexType);
}
// See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29
if (in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) {
$assocArray = array();
foreach ($array as $keyValue) {
$assocArray[$keyValue->getKey()] = $keyValue->getValue();
}
$array = $assocArray;
}
}
$message = $array;
} else {
@ -112,9 +128,8 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$value = $this->processType($type->getType(), $value);
$messageBinder->writeProperty($property, $value);
}
if (!$type->isNillable() && null === $value) {
} elseif (!$type->isNillable()) {
// @TODO use xmlType instead of phpType
throw new \SoapFault('SOAP_ERROR_COMPLEX_TYPE', sprintf('"%s:%s" cannot be null.', ucfirst($phpType), $type->getName()));
}
}

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)
@ -85,7 +88,7 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
$this->messageRefs[$hash] = $message;
if (!$message instanceof $phpType) {
throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', get_class($message), $phpType));
throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', $phpType, get_class($message)));
}
$messageBinder = new MessageBinder($message);

View File

@ -18,6 +18,7 @@ class ComplexType extends Configuration
private $name;
private $value;
private $isNillable = false;
private $isAttribute = false;
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,33 @@ class ComplexType extends Configuration
$this->isNillable = (bool) $isNillable;
}
public function setIsNillable($isNillable)
{
$this->isNillable = (bool) $isNillable;
}
/**
* @return bool
*/
public function isAttribute()
{
return $this->isAttribute;
}
/**
* @param bool $isAttribute
*
* @return $this
*/
public function setIsAttribute($isAttribute)
{
$this->isAttribute = $isAttribute;
return $this;
}
public function getAliasName()
{
return 'complextype';
}
}
}

View File

@ -20,6 +20,7 @@ class ComplexType
private $name;
private $value;
private $isNillable = false;
private $isAttribute = false;
public function getName()
{
@ -46,6 +47,26 @@ class ComplexType
$this->value = $value;
}
/**
* @return bool
*/
public function isAttribute()
{
return $this->isAttribute;
}
/**
* @param bool $isAttribute
*
* @return $this
*/
public function setIsAttribute($isAttribute)
{
$this->isAttribute = $isAttribute;
return $this;
}
public function setNillable($isNillable)
{
$this->isNillable = (bool) $isNillable;

View File

@ -88,7 +88,6 @@ class AnnotationClassLoader extends Loader
$serviceMethod = new Definition\Method(
$annotation->getValue(),
$this->typeRepository,
$this->getController($class, $method, $annotation)
);
} elseif ($annotation instanceof Annotation\Result) {
@ -97,6 +96,7 @@ class AnnotationClassLoader extends Loader
}
$serviceReturn = $annotation->getPhpType();
$serviceXmlReturn = $annotation->getXmlType();
}
}
@ -117,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);
}
@ -156,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->isAttribute());
}
$this->typeRepository->addComplexType($complexType);

View File

@ -58,6 +58,7 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
$propertyComplexType = new ComplexType();
$propertyComplexType->setValue($complexType->getValue());
$propertyComplexType->setNillable($complexType->isNillable());
$propertyComplexType->setIsAttribute($complexType->isAttribute());
$propertyComplexType->setName($property->getName());
$annotations['properties']->add($propertyComplexType);
}

View File

@ -23,9 +23,9 @@ class Method extends BaseMethod
{
private $controller;
public function __construct($name, TypeRepository $typeRepository, $controller)
public function __construct($name, $controller)
{
parent::__construct($name, $typeRepository);
parent::__construct($name);
$this->controller = $controller;
}

View File

@ -16,66 +16,70 @@ use BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestMessageBinder;
use BeSimple\SoapBundle\ServiceDefinition as Definition;
use BeSimple\SoapBundle\Tests\fixtures\ServiceBinding as Fixtures;
use BeSimple\SoapBundle\Util\Collection;
use BeSimple\SoapCommon\Definition\Type\ComplexType;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider messageProvider
*/
public function testProcessMessage(Definition\Method $method, $message, $assert)
public function testProcessMessage(Definition\Method $method, array $message, array $assert)
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$result = $messageBinder->processMessage($method, $message);
$result = $messageBinder->processMessage($method, $message, $this->getTypeRepository());
$this->assertSame($assert, $result);
}
public function testProcessMessageWithComplexType()
{
$typeRepository = $this->addComplexTypes($this->getTypeRepository());
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('complextype_argument', null);
$method->addInput('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo');
$foo = new Fixtures\Foo('foobar', 19395);
$result = $messageBinder->processMessage(
new Definition\Method('complextype_argument', null, array(), array(
new Definition\Argument('foo', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo')),
)),
$method,
array($foo),
$this->getDefinitionComplexTypes()
$typeRepository
);
$this->assertEquals(array('foo' => $foo), $result);
$foo1 = new Fixtures\Foo('foobar', 29291);
$foo2 = new Fixtures\Foo('barfoo', 39392);
$foos = new \stdClass();
$foos->item = array($foo1, $foo2);
$method = new Definition\Method('complextype_argument', null);
$method->addInput('foos', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo[]');
$result = $messageBinder->processMessage(
new Definition\Method('complextype_argument', null, array(), array(
new Definition\Argument('foos', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo[]')),
)),
$method,
array($foos),
$this->getDefinitionComplexTypes()
$typeRepository
);
$this->assertEquals(array('foos' => array($foo1, $foo2)), $result);
}
/**
* @expectedException SoapFault
*/
public function testProcessMessageSoapFault()
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('complextype_argument', null);
$method->addInput('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo');
$foo = new Fixtures\Foo('foo', null);
$result = $messageBinder->processMessage(
new Definition\Method('complextype_argument', null, array(), array(
new Definition\Argument('foo', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo')),
)),
$this->setExpectedException('SoapFault');
$messageBinder->processMessage(
$method,
array($foo),
$this->getDefinitionComplexTypes()
$this->addComplexTypes($this->getTypeRepository())
);
}
@ -83,16 +87,17 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('complextype_argument', null);
$method->addInput('foos', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo[]');
$foo = new Fixtures\Foo('foo', 2499104);
$foos = new \stdClass();
$foos->item = array($foo, $foo);
$result = $messageBinder->processMessage(
new Definition\Method('complextype_argument', null, array(), array(
new Definition\Argument('foos', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo[]')),
)),
$method,
array($foos),
$this->getDefinitionComplexTypes()
$this->addComplexTypes($this->getTypeRepository())
);
$this->assertEquals(array('foos' => array($foo, $foo)), $result);
@ -102,16 +107,17 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('complextype_argument', null);
$method->addInput('fooBar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooBar');
$foo = new Fixtures\Foo('foo', 38845);
$bar = new Fixtures\Bar('bar', null);
$fooBar = new Fixtures\FooBar($foo, $bar);
$result = $messageBinder->processMessage(
new Definition\Method('complextype_argument', null, array(), array(
new Definition\Argument('fooBar', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooBar')),
)),
$method,
array($fooBar),
$this->getDefinitionComplexTypes()
$this->addComplexTypes($this->getTypeRepository())
);
$this->assertEquals(array('fooBar' => $fooBar), $result);
@ -121,17 +127,18 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('complextype_with_array', null);
$method->addInput('simple_arrays', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\SimpleArrays');
$array = array(1, 2, 3, 4);
$stdClass = new \stdClass();
$stdClass->item = $array;
$simpleArrays = new Fixtures\SimpleArrays(null, new \stdClass(), $stdClass);
$result = $messageBinder->processMessage(
new Definition\Method('complextype_with_array', null, array(), array(
new Definition\Argument('simple_arrays', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\SimpleArrays')),
)),
$method,
array($simpleArrays),
$this->getDefinitionComplexTypes()
$this->addComplexTypes($this->getTypeRepository())
);
$result = $result['simple_arrays'];
@ -144,12 +151,13 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('empty_array_complex_type', null);
$method->addInput('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo[]');
$result = $messageBinder->processMessage(
new Definition\Method('empty_array_complex_type', null, array(), array(
new Definition\Argument('foo', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo[]')),
)),
$method,
array(new \stdClass()),
$this->getDefinitionComplexTypes()
$this->addComplexTypes($this->getTypeRepository())
);
$this->assertEquals(array('foo' => array()), $result);
@ -159,16 +167,17 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$method = new Definition\Method('prevent_infinite_recursion', null);
$method->addInput('foo_recursive', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive');
$foo = new Fixtures\FooRecursive('foo', '');
$bar = new Fixtures\BarRecursive($foo, 10394);
$foo->bar = $bar;
$result = $messageBinder->processMessage(
new Definition\Method('prevent_infinite_recursion', null, array(), array(
new Definition\Argument('foo_recursive', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive')),
)),
$method,
array($foo),
$this->getDefinitionComplexTypes()
$this->addComplexTypes($this->getTypeRepository())
);
$this->assertEquals(array('foo_recursive' => $foo), $result);
@ -179,43 +188,43 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
$messages = array();
$messages[] = array(
new Definition\Method('no_argument'),
new Definition\Method('no_argument', null),
array(),
array(),
);
$method = new Definition\Method('string_argument', null);
$method->addInput('foo', 'string');
$messages[] = array(
new Definition\Method('string_argument', null, array(), array(
new Definition\Argument('foo', new Definition\Type('string')),
)),
$method,
array('bar'),
array('foo' => 'bar'),
);
$method = new Definition\Method('string_int_arguments', null);
$method->addInput('foo', 'string');
$method->addInput('bar', 'int');
$messages[] = array(
new Definition\Method('string_int_arguments', null, array(), array(
new Definition\Argument('foo', new Definition\Type('string')),
new Definition\Argument('bar', new Definition\Type('int')),
)),
$method,
array('test', 20),
array('foo' => 'test', 'bar' => 20),
);
$method = new Definition\Method('array_string_arguments', null);
$method->addInput('foo', 'string[]');
$method->addInput('bar', 'int');
$strings = new \stdClass();
$strings->item = array('foo', 'bar', 'barfoo');
$messages[] = array(
new Definition\Method('array_string_arguments', null, array(), array(
new Definition\Argument('foo', new Definition\Type('string[]')),
new Definition\Argument('bar', new Definition\Type('int')),
)),
$method,
array($strings, 4),
array('foo' => array('foo', 'bar', 'barfoo'), 'bar' => 4),
);
$method = new Definition\Method('empty_array', null);
$method->addInput('foo', 'string[]');
$messages[] = array(
new Definition\Method('empty_array', null, array(), array(
new Definition\Argument('foo', new Definition\Type('string[]')),
)),
$method,
array(new \stdClass()),
array('foo' => array()),
);
@ -223,40 +232,38 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
return $messages;
}
private function getDefinitionComplexTypes()
private function addComplexTypes(TypeRepository $typeRepository)
{
$definitionComplexTypes = array();
$foo = new ComplexType('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo', 'Foo');
$foo->add('foo', 'string');
$foo->add('bar', 'int');
$typeRepository->addComplexType($foo);
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo'] = $this->createComplexTypeCollection(array(
array('foo', 'string'),
array('bar', 'int'),
));
$bar = new ComplexType('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Bar', 'Bar');
$bar->add('foo', 'string');
$bar->add('bar', 'int', true);
$typeRepository->addComplexType($bar);
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Bar'] = $this->createComplexTypeCollection(array(
array('foo', 'string'),
array('bar', 'int', true),
));
$fooBar = new ComplexType('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooBar', 'FooBar');
$fooBar->add('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo');
$fooBar->add('bar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Bar');
$typeRepository->addComplexType($fooBar);
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooBar'] = $this->createComplexTypeCollection(array(
array('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Foo'),
array('bar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Bar'),
));
$simpleArrays = new ComplexType('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\SimpleArrays', 'SimpleArrays');
$simpleArrays->add('array1', 'string[]', true);
$simpleArrays->add('array2', 'string[]');
$simpleArrays->add('array3', 'string[]');
$typeRepository->addComplexType($simpleArrays);
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\SimpleArrays'] = $this->createComplexTypeCollection(array(
array('array1', 'string[]', true),
array('array2', 'string[]'),
array('array3', 'string[]'),
));
$fooRecursive = new ComplexType('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive', 'FooRecursive');
$fooRecursive->add('bar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\BarRecursive');
$typeRepository->addComplexType($fooRecursive);
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive'] = $this->createComplexTypeCollection(array(
array('bar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\BarRecursive'),
));
$barRecursive = new ComplexType('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\BarRecursive', 'BarRecursive');
$barRecursive->add('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive');
$typeRepository->addComplexType($barRecursive);
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\BarRecursive'] = $this->createComplexTypeCollection(array(
array('foo', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive'),
));
return $definitionComplexTypes;
return $typeRepository;
}
private function createComplexTypeCollection(array $properties)
@ -277,4 +284,18 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
return array('properties' => $collection);
}
private function getTypeRepository()
{
$typeRepository = new TypeRepository();
$typeRepository->addXmlNamespace('xsd', 'http://www.w3.org/2001/XMLSchema');
$typeRepository->addType('string', 'xsd:string');
$typeRepository->addType('boolean', 'xsd:boolean');
$typeRepository->addType('int', 'xsd:int');
$typeRepository->addType('float', 'xsd:float');
$typeRepository->addType('date', 'xsd:date');
$typeRepository->addType('dateTime', 'xsd:dateTime');
return $typeRepository;
}
}

View File

@ -23,6 +23,8 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase
{
public function testMtomMessage()
{
$this->markTestSkipped('Skip because I\'m not sure that SoapRequest is used in a HTTP Request process.');
$content = $this->loadRequestContentFixture('mtom/simple.txt');
$request = new SoapRequest(array(), array(), array(), array(), array(), array(), $content);

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.

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']));
@ -78,11 +78,14 @@ class WebServiceContext
$definition->setOption('location', $endpoint);
}
$dumper = new Dumper($definition);
$cache->write($dumper->dump());
$dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet']));
$wsdl = $dumper->dump();
$cache->write($wsdl);
}
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": {
@ -37,7 +37,6 @@
"psr-0": { "BeSimple\\SoapBundle": "" }
},
"target-dir": "BeSimple/SoapBundle",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"

View File

@ -80,21 +80,39 @@ class Curl
if (isset($options['connection_timeout'])) {
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $options['connection_timeout']);
}
if (isset($options['proxy_host'])) {
$port = isset($options['proxy_port']) ? $options['proxy_port'] : 8080;
curl_setopt($this->ch, CURLOPT_PROXY, $options['proxy_host'] . ':' . $port);
}
if (isset($options['proxy_user'])) {
curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'] . ':' . $options['proxy_password']);
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, CURLAUTH_ANY);
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']);
}
}
/**
@ -112,10 +130,11 @@ class Curl
* @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())
public function exec($location, $request = null, $requestHeaders = array(), $requestOptions = array())
{
curl_setopt($this->ch, CURLOPT_URL, $location);
@ -128,6 +147,10 @@ class Curl
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;
@ -310,4 +333,4 @@ class Curl
return trim(array_pop($matches));
}
}
}

View File

@ -41,15 +41,6 @@ class SoapClient extends \SoapClient
*/
protected $tracingEnabled = false;
/**
* Work around missing header/php://input access in PHP cli webserver by
* setting headers additionally as GET parameters and SOAP request body
* explicitly as POST variable.
*
* @var boolean
*/
private $cliWebserverWorkaround = false;
/**
* cURL instance.
*
@ -108,11 +99,13 @@ class SoapClient extends \SoapClient
if (isset($options['soap_version'])) {
$this->soapVersion = $options['soap_version'];
}
// activate cli webserver workaround
if (isset($options['cli_webserver_workaround'])) {
$this->cliWebserverWorkaround = $options['cli_webserver_workaround'];
}
$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();
@ -153,32 +146,19 @@ class SoapClient extends \SoapClient
$location = $soapRequest->getLocation();
$content = $soapRequest->getContent();
/*
* Work around missing header/php://input access in PHP cli webserver by
* setting headers additionally as GET parameters and SOAP request body
* explicitly as POST variable
*/
if ($this->cliWebserverWorkaround === true) {
if (strpos($location, '?') === false) {
$location .= '?';
} else {
$location .= '&';
}
$location .= SoapMessage::CONTENT_TYPE_HEADER.'='.urlencode($soapRequest->getContentType());
$location .= '&';
$location .= SoapMessage::SOAP_ACTION_HEADER.'='.urlencode($soapRequest->getAction());
$content = http_build_query(array('request' => $content));
$headers = $this->filterRequestHeaders($soapRequest, $headers);
$headers = array();
}
$options = $this->filterRequestOptions($soapRequest);
// execute HTTP request with cURL
$responseSuccessfull = $this->curl->exec(
$location,
$content,
$headers
$headers,
$options
);
// tracing enabled: store last request header and body
if ($this->tracingEnabled === true) {
$this->lastRequestHeaders = $this->curl->getRequestHeaders();
@ -253,6 +233,31 @@ class SoapClient extends \SoapClient
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.
*
@ -354,7 +359,7 @@ class SoapClient extends \SoapClient
*
* @return string
*/
private function loadWsdl($wsdl, array $options)
protected function loadWsdl($wsdl, array $options)
{
// option to resolve wsdl/xsd includes
$resolveRemoteIncludes = true;

View File

@ -175,19 +175,28 @@ class SoapClientBuilder extends AbstractSoapBuilder
*
* @param string $host Host
* @param int $port Port
* @param string $username Username
* @param string $login Login
* @param string $password Password
* @param int $auth Authentication method
*
* @return \BeSimple\SoapClient\SoapClientBuilder
*/
public function withProxy($host, $port, $username = null, $password = null)
public function withProxy($host, $port, $login = null, $password = null, $auth = null)
{
$this->soapOptions['proxy_host'] = $host;
$this->soapOptions['proxy_port'] = $port;
if ($username) {
$this->soapOptions['proxy_login'] = $username;
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;
@ -236,4 +245,4 @@ class SoapClientBuilder extends AbstractSoapBuilder
{
$this->validateWsdl();
}
}
}

View File

@ -24,7 +24,6 @@ abstract class AbstractWebServerTest extends \PHPUnit_Framework_TestCase
* @var ProcessBuilder
*/
static protected $webserver;
static protected $websererPortLength;
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

@ -28,6 +28,7 @@ class MtomAxisInteropTest extends TestCase
'base64Binary' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\base64Binary',
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\AttachmentRequest',
),
'proxy_host' => false,
);
public function testAttachment()
@ -48,4 +49,4 @@ class MtomAxisInteropTest extends TestCase
// $this->assertEquals($b64->_, file_get_contents($fileCreatedByServer));
// unlink($fileCreatedByServer);
}
}
}

View File

@ -37,6 +37,7 @@ class SwaAxisInteropTest extends TestCase
'uploadFile' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFile',
'uploadFileResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFileResponse',
),
'proxy_host' => false,
);
public function testUploadDownloadText()
@ -74,4 +75,4 @@ class SwaAxisInteropTest extends TestCase
$this->assertEquals($upload->data, $result->data);
}
}
}

View File

@ -32,6 +32,7 @@ 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()
@ -56,4 +57,4 @@ class WsAddressingAxisInteropTest extends TestCase
$this->assertEquals($soapSessionId1, $soapSessionId2);
}
}
}

View File

@ -64,6 +64,7 @@ class WsSecuritySigEncAxisInteropTest extends TestCase
'addBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation',
),
'proxy_host' => false,
);
public function testSigEnc()
@ -103,4 +104,4 @@ class WsSecuritySigEncAxisInteropTest extends TestCase
// getBooksByType("scifi");
}
}
}

View File

@ -40,6 +40,7 @@ class WsSecurityUserPassAxisInteropTest extends TestCase
'addBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation',
),
'proxy_host' => false,
);
public function testUserPassText()
@ -93,4 +94,4 @@ class WsSecurityUserPassAxisInteropTest extends TestCase
// getBooksByType("scifi");
}
}
}

View File

@ -21,7 +21,9 @@ class CurlTest extends AbstractWebserverTest
{
public function testExec()
{
$curl = new Curl();
$curl = new Curl(array(
'proxy_host' => false,
));
$this->assertTrue($curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT)));
$this->assertTrue($curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT)));
@ -29,7 +31,9 @@ class CurlTest extends AbstractWebserverTest
public function testGetErrorMessage()
{
$curl = new Curl();
$curl = new Curl(array(
'proxy_host' => false,
));
$curl->exec('http://unknown/curl.txt');
$this->assertEquals('Could not connect to host', $curl->getErrorMessage());
@ -41,24 +45,14 @@ class CurlTest extends AbstractWebserverTest
$this->assertEquals('Unable to parse URL', $curl->getErrorMessage());
}
public function testGetRequestHeaders()
{
$curl = new Curl();
$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();
$curl = new Curl(array(
'proxy_host' => false,
));
$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());
@ -66,7 +60,9 @@ class CurlTest extends AbstractWebserverTest
public function testGetResponseBody()
{
$curl = new Curl();
$curl = new Curl(array(
'proxy_host' => false,
));
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
$this->assertEquals('This is a testfile for cURL.', $curl->getResponseBody());
@ -74,7 +70,9 @@ class CurlTest extends AbstractWebserverTest
public function testGetResponseContentType()
{
$curl = new Curl();
$curl = new Curl(array(
'proxy_host' => false,
));
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
$this->assertEquals('text/plain; charset=UTF-8', $curl->getResponseContentType());
@ -83,20 +81,11 @@ class CurlTest extends AbstractWebserverTest
$this->assertEquals('text/html; charset=UTF-8', $curl->getResponseContentType());
}
public function testGetResponseHeaders()
{
$curl = new Curl();
$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();
$curl = new Curl(array(
'proxy_host' => false,
));
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
$this->assertEquals(200, $curl->getResponseStatusCode());

View File

@ -18,7 +18,6 @@ $options = array(
'base64Binary' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\base64Binary',
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
'connection_timeout' => 1,
);

View File

@ -14,13 +14,13 @@ $options = array(
'cache_wsdl' => WSDL_CACHE_NONE,
'classmap' => array(
'base64Binary' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\base64Binary',
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
'AttachmentType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
),
);
class Mtom
{
public function attachment(AttachmentRequest $attachment)
public function attachment(Fixtures\AttachmentRequest $attachment)
{
$b64 = $attachment->binaryData;

View File

@ -20,7 +20,7 @@ class MtomServerInteropTest extends TestCase
'base64Binary' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\base64Binary',
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
'proxy_host' => false,
);
public function testAttachment()
@ -41,4 +41,4 @@ class MtomServerInteropTest extends TestCase
$this->assertEquals($b64->_, file_get_contents($fileCreatedByServer));
unlink($fileCreatedByServer);
}
}
}

View File

@ -24,7 +24,6 @@ $options = array(
'uploadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFile',
'uploadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFileResponse',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
);
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $options);

View File

@ -23,7 +23,7 @@ class SwaServerInteropTest extends TestCase
'uploadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFile',
'uploadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFileResponse',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
'proxy_host' => false,
);
public function testUploadDownloadText()
@ -42,6 +42,8 @@ class SwaServerInteropTest extends TestCase
$result = $sc->downloadFile($download);
$this->assertEquals($upload->data, $result->data);
unlink(__DIR__.'/../ServerInterop/'.$download->name);
}
public function testUploadDownloadImage()
@ -60,5 +62,7 @@ class SwaServerInteropTest extends TestCase
$result = $sc->downloadFile($download);
$this->assertEquals($upload->data, $result->data);
unlink(__DIR__.'/../ServerInterop/'.$download->name);
}
}
}

View File

@ -31,7 +31,6 @@ $options = array(
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
);
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecuritySigEnc.wsdl', $options);

View File

@ -30,7 +30,7 @@ class WsSecuritySigEncServerInteropTest extends TestCase
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
'proxy_host' => false,
);
public function testSigEnc()
@ -70,4 +70,4 @@ class WsSecuritySigEncServerInteropTest extends TestCase
// getBooksByType("scifi");
}
}
}

View File

@ -28,7 +28,6 @@ $options = array(
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
);
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $options);

View File

@ -29,7 +29,7 @@ class WsSecurityUserPassServerInteropTest extends TestCase
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
),
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
'proxy_host' => false,
);
public function testUserPassText()
@ -83,4 +83,4 @@ class WsSecurityUserPassServerInteropTest extends TestCase
// getBooksByType("scifi");
}
}
}

View File

@ -96,6 +96,20 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar');
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar')), $builder->getSoapOptions());
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar', \CURLAUTH_BASIC);
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar', 'proxy_auth' => \CURLAUTH_BASIC)), $builder->getSoapOptions());
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar', \CURLAUTH_NTLM);
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar', 'proxy_auth' => \CURLAUTH_NTLM)), $builder->getSoapOptions());
try {
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar', -100);
$this->fail('An expected exception has not been raised.');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e);
}
}
public function testCreateWithDefaults()

View File

@ -41,7 +41,9 @@ class WsdlDownloaderTest extends AbstractWebserverTest
Cache::setDirectory($wsdlCacheUrl);
$cacheDirForRegExp = preg_quote($wsdlCacheUrl, '#');
$wsdlDownloader = new WsdlDownloader(new Curl());
$wsdlDownloader = new WsdlDownloader(new Curl(array(
'proxy_host' => false,
)));
$this->assertCount(0, $wsdlCacheDir->getChildren());
$cacheFileName = $wsdlDownloader->download($source);
@ -113,7 +115,9 @@ class WsdlDownloaderTest extends AbstractWebserverTest
Cache::setDirectory($wsdlCacheUrl);
$cacheDirForRegExp = preg_quote($wsdlCacheUrl, '#');
$wsdlDownloader = new WsdlDownloader(new Curl());
$wsdlDownloader = new WsdlDownloader(new Curl(array(
'proxy_host' => false,
)));
$r = new \ReflectionClass($wsdlDownloader);
$m = $r->getMethod('resolveRemoteIncludes');
$m->setAccessible(true);
@ -176,7 +180,9 @@ class WsdlDownloaderTest extends AbstractWebserverTest
Cache::setDirectory($wsdlCacheUrl);
$cacheDirForRegExp = preg_quote($wsdlCacheUrl, '#');
$wsdlDownloader = new WsdlDownloader(new Curl());
$wsdlDownloader = new WsdlDownloader(new Curl(array(
'proxy_host' => false,
)));
$r = new \ReflectionClass($wsdlDownloader);
$m = $r->getMethod('resolveRemoteIncludes');
$m->setAccessible(true);
@ -272,7 +278,7 @@ class WsdlDownloaderTest extends AbstractWebserverTest
$content = file_get_contents(self::$fixturesPath.$file);
$content = preg_replace('#'.preg_quote('%location%').'#', sprintf('localhost:%d', WEBSERVER_PORT), $content);
self::$filesystem->dumpFile(self::$fixturesPath.'build_include'.DIRECTORY_SEPARATOR.pathinfo($file, PATHINFO_BASENAME), $content);
file_put_contents(self::$fixturesPath.'build_include'.DIRECTORY_SEPARATOR.pathinfo($file, PATHINFO_BASENAME), $content);
}
}

View File

@ -23,12 +23,12 @@ if [ ! -f "$DIR/$ZIP_RAMPART" ]; then
curl -O -s $PATH_RAMPART
fi
unzip -qq "$DIR/$ZIP_AXIS"
unzip -o -qq "$DIR/$ZIP_AXIS"
AXIS_DIR=$DIR/axis2-$VERSION_AXIS
unzip -qq -j "$DIR/$ZIP_RAMPART" '*/lib/*.jar' -d $AXIS_DIR/lib
unzip -qq -j "$DIR/$ZIP_RAMPART" '*/modules/*.mar' -d $AXIS_DIR/repository/modules
unzip -o -qq -j "$DIR/$ZIP_RAMPART" '*/lib/*.jar' -d $AXIS_DIR/lib
unzip -o -qq -j "$DIR/$ZIP_RAMPART" '*/modules/*.mar' -d $AXIS_DIR/repository/modules
cp -r $DIR/../AxisInterop/axis_services/* $AXIS_DIR/repository/services

View File

@ -27,15 +27,14 @@
"ass/xmlsecurity": "~1.0"
},
"require-dev": {
"mikey179/vfsStream": "dev-master",
"symfony/filesystem": "~2.3",
"mikey179/vfsStream": "~1.0",
"symfony/filesystem": "~2.0",
"symfony/process": "~2.3"
},
"autoload": {
"psr-0": { "BeSimple\\SoapClient": "" }
},
"target-dir": "BeSimple/SoapClient",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"

View File

@ -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, $attribute = false)
{
if ($phpType instanceof TypeInterface) {
$phpType = $phpType->getPhpType();
}
$this->parts[$name] = new Part($name, $phpType, $nillable);
$this->parts[$name] = new Part($name, $phpType, $nillable, $attribute);
return $this;
}

View File

@ -26,14 +26,14 @@ class Method
private $output;
private $fault;
public function __construct($name, TypeRepository $typeRepository)
public function __construct($name)
{
$this->name = $name;
$this->headers = new Message($name.'Header', $typeRepository);
$this->input = new Message($name.'Request', $typeRepository);
$this->output = new Message($name.'Response', $typeRepository);
$this->fault = new Message($name.'Fault', $typeRepository);
$this->headers = new Message($name.'Header');
$this->input = new Message($name.'Request');
$this->output = new Message($name.'Response');
$this->fault = new Message($name.'Fault');
}
public function getName()
@ -53,7 +53,7 @@ class Method
public function getUse()
{
return \SOAP_LITERAL;
return \SOAP_ENCODED;
}
public function addHeader($name, $type)
@ -66,9 +66,13 @@ class Method
$this->input->add($name, $type);
}
public function setOutput($type)
public function setOutput($type, $name = 'return')
{
$this->output->add('return', $type);
if ('return' !== $name) {
$this->output = new Message($name);
}
$this->output->add($name, $type);
}
public function getHeaders()

View File

@ -20,12 +20,14 @@ class Part
protected $name;
protected $type;
protected $nillable;
protected $attribute;
public function __construct($name, $type, $nillable = false)
public function __construct($name, $type, $nillable = false, $attribute = false)
{
$this->name = $name;
$this->type = $type;
$this->setNillable($nillable);
$this->setAttribute($attribute);
}
public function getName()
@ -33,6 +35,26 @@ class Part
return $this->name;
}
/**
* @return bool
*/
public function isAttribute()
{
return $this->attribute;
}
/**
* @param bool $attribute
*
* @return $this
*/
public function setAttribute($attribute)
{
$this->attribute = $attribute;
return $this;
}
public function getType()
{
return $this->type;

View File

@ -28,6 +28,13 @@ abstract class SoapMessage
*/
const CONTENT_TYPE_HEADER = 'CONTENT_TYPE';
/**
* $_SERVER key for 'Content-Type' header (with PHP cli-webserver)
*
* @var string
*/
const HTTP_CONTENT_TYPE_HEADER = 'HTTP_CONTENT_TYPE';
/**
* $_SERVER key for 'SOAPAction' header.
*

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

View File

@ -25,14 +25,12 @@
"ass/xmlsecurity": "~1.0"
},
"require-dev": {
"ext-mcrypt": "*",
"mikey179/vfsStream": "dev-master"
"mikey179/vfsstream": "~1.0"
},
"autoload": {
"psr-0": { "BeSimple\\SoapCommon": "" }
},
"target-dir": "BeSimple/SoapCommon",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"

View File

@ -32,29 +32,19 @@ class SoapRequest extends CommonSoapRequest
*/
public static function create($content, $version)
{
$location = self::getCurrentUrl();
/*
* Work around missing header/php://input access in PHP cli webserver by
* setting headers additionally as GET parameters and SOAP request body
* explicitly as POST variable
*/
if (php_sapi_name() == "cli-server") {
$content = is_null($content) ? $_POST['request'] : $content;
$action = $_GET[SoapMessage::SOAP_ACTION_HEADER];
$contentType = $_GET[SoapMessage::CONTENT_TYPE_HEADER];
} else {
$content = is_null($content) ? file_get_contents("php://input") : $content;
$action = isset($_SERVER[SoapMessage::SOAP_ACTION_HEADER]) ? $_SERVER[SoapMessage::SOAP_ACTION_HEADER] : null;
$contentType = $_SERVER[SoapMessage::CONTENT_TYPE_HEADER];
}
$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->setContent((string) (null === $content ? file_get_contents("php://input") : $content));
$request->setLocation(self::getCurrentUrl());
$request->setAction(isset($_SERVER[SoapMessage::SOAP_ACTION_HEADER]) ? $_SERVER[SoapMessage::SOAP_ACTION_HEADER] : null);
$request->setVersion($version);
$request->setContentType($contentType);
if (isset($_SERVER[SoapMessage::CONTENT_TYPE_HEADER])) {
$request->setContentType($_SERVER[SoapMessage::CONTENT_TYPE_HEADER]);
} elseif (isset($_SERVER[SoapMessage::HTTP_CONTENT_TYPE_HEADER])) {
$request->setContentType($_SERVER[SoapMessage::HTTP_CONTENT_TYPE_HEADER]);
}
return $request;
}

View File

@ -100,6 +100,34 @@ class SoapServer extends \SoapServer
parent::handle($soapRequest->getContent());
$response = ob_get_clean();
$dom = \DOMDocument::loadXML($response);
/** @var \DOMElement $envelop */
$envelop = $dom->childNodes->item(0);
$ns1 = $envelop->getAttribute('xmlns:ns1');
$envelop->removeAttributeNS($ns1, 'ns1');
$envelop->prefix = 'soap';
$envelop->setAttribute('soap:encodingStyle', 'http://schemas.xmlsoap.org/soap/encoding/');
$envelop->setAttribute('xmlns:soapenc', 'http://schemas.xmlsoap.org/soap/encoding/');
$envelop->setAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
$envelop->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
/** @var \DOMElement $body */
$body = $envelop->childNodes->item(0);
$body->prefix = 'soap';
/** @var \DOMElement $responseRoot */
$responseRoot = $body->childNodes->item(0);
$responseRoot->setAttribute('xmlns', $ns1);
$envelop->removeAttributeNS('http://schemas.xmlsoap.org/soap/envelope/', 'SOAP-ENV');
$envelop->removeAttributeNS('http://schemas.xmlsoap.org/soap/encoding/', 'SOAP-ENC');
$response = $dom->saveXML();
$response = preg_replace('/xsi:type="ns1:\w*"/', '', $response);
// Remove headers added by SoapServer::handle() method
header_remove('Content-Length');
header_remove('Content-Type');

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

@ -29,7 +29,6 @@
"psr-0": { "BeSimple\\SoapServer": "" }
},
"target-dir": "BeSimple/SoapServer",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"

View File

@ -61,7 +61,7 @@ abstract class AbstractVersion implements VersionInterface
{
if (!$this->bindingNode) {
$this->bindingNode = $this->document->createElement('binding');
$this->bindingNode->setAttribute('name', $this->name.'Binding');
$this->bindingNode->setAttribute('name', $this->name.'_SOAP');
$this->bindingNode->setAttribute('type', $this->portTypeName);
$this->addSoapBinding();
@ -75,7 +75,7 @@ abstract class AbstractVersion implements VersionInterface
if (!$this->servicePortNode) {
$this->servicePortNode = $this->document->createElement('port');
$this->servicePortNode->setAttribute('name', $this->name.'Port');
$this->servicePortNode->setAttribute('binding', $this->typeNs.':'.$this->name.'Binding');
$this->servicePortNode->setAttribute('binding', $this->typeNs.':'.$this->name.'_SOAP');
$this->addSoapAddress();
}

View File

@ -69,6 +69,7 @@ class Dumper
'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12',
'version11_name' => $this->definition->getName(),
'version12_name' => $this->definition->getName().'12',
'stylesheet' => null,
);
$invalid = array();
@ -123,6 +124,8 @@ class Dumper
$this->document->formatOutput = true;
$this->addStylesheet();
return $this->document->saveXML();
}
@ -186,7 +189,7 @@ class Dumper
protected function addMessages(array $messages)
{
foreach ($messages as $message) {
if ($message->isEmpty()) {
if (preg_match('#Header$#', $message->getName()) && $message->isEmpty()) {
continue;
}
@ -200,9 +203,9 @@ class Dumper
$partElement->setAttribute('name', $part->getName());
if ($type instanceof ComplexType) {
$partElement->setAttribute('type', static::TYPES_NS.':'.$type->getXmlType());
$partElement->setAttribute('element', static::TYPES_NS.':'.$type->getXmlType());
} else {
$partElement->setAttribute('type', $type);
$partElement->setAttribute('element', $type);
}
$messageElement->appendChild($partElement);
@ -214,11 +217,13 @@ class Dumper
protected function addComplexTypes()
{
$types = $this->document->createElement('types');
$types = $this->document->createElement(static::WSDL_NS . ':types');
$this->domDefinitions->appendChild($types);
$this->domSchema = $this->document->createElement(static::XSD_NS.':schema');
$this->domSchema->setAttribute('targetNamespace', $this->definition->getNamespace());
$this->domSchema->setAttribute('elementFormDefault', 'unqualified');
$this->domSchema->setAttribute(static::XML_NS.':'.static::XSD_NS, static::XSD_NS_URI);
$types->appendChild($this->domSchema);
foreach ($this->definition->getTypeRepository()->getComplexTypes() as $type) {
@ -233,13 +238,18 @@ class Dumper
$complexType = $this->document->createElement(static::XSD_NS.':complexType');
$complexType->setAttribute('name', $type->getXmlType());
$all = $this->document->createElement(static::XSD_NS.':'.($type instanceof ArrayOfType ? 'sequence' : 'all'));
$all = $this->document->createElement(static::XSD_NS.':'.'sequence');
$complexType->appendChild($all);
foreach ($type->all() as $child) {
$isArray = false;
$childType = $this->definition->getTypeRepository()->getType($child->getType());
$element = $this->document->createElement(static::XSD_NS.':element');
if ($child->isAttribute()) {
$element = $this->document->createElement(static::XSD_NS.':attribute');
} else {
$element = $this->document->createElement(static::XSD_NS.':element');
}
$element->setAttribute('name', $child->getName());
if ($childType instanceof ComplexType) {
@ -254,15 +264,23 @@ class Dumper
}
if ($child->isNillable()) {
$element->setAttribute('nillable', 'true');
$element->setAttribute('minOccurs', 0);
} else {
$element->setAttribute('minOccurs', 1);
}
if ($type instanceof ArrayOfType) {
if ($type instanceof ArrayOfType || $isArray) {
$element->setAttribute('minOccurs', 0);
$element->setAttribute('maxOccurs', 'unbounded');
} else {
$element->setAttribute('maxOccurs', 1);
}
$all->appendChild($element);
if ($child->isAttribute()) {
$complexType->appendChild($element);
} else {
$all->appendChild($element);
}
}
$this->domSchema->appendChild($complexType);
@ -282,7 +300,7 @@ class Dumper
$operation->setAttribute('name', $method->getName());
foreach (array('input' => $method->getInput(), 'output' => $method->getOutput(), 'fault' => $method->getFault()) as $type => $message) {
if ($message->isEmpty()) {
if ('fault' === $type && $message->isEmpty()) {
continue;
}
@ -297,6 +315,15 @@ class Dumper
return $operation;
}
protected function addStylesheet()
{
if ($this->options['stylesheet']) {
$stylesheet = $this->document->createProcessingInstruction('xml-stylesheet', sprintf('type="text/xsl" href="%s"', $this->options['stylesheet']));
$this->document->insertBefore($stylesheet, $this->document->documentElement);
}
}
protected function getVersion($version)
{
if (\SOAP_1_2 === $version) {

View File

@ -22,7 +22,6 @@
"psr-0": { "BeSimple\\SoapWsdl": "" }
},
"target-dir": "BeSimple/SoapWsdl",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"