diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/AttachmentRequest.php b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/AttachmentRequest.php
new file mode 100644
index 0000000..e4f0236
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/AttachmentRequest.php
@@ -0,0 +1,7 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA.wsdl b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/SwA.wsdl
similarity index 98%
rename from src/BeSimple/SoapClient/Tests/AxisInterop/SwA.wsdl
rename to src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/SwA.wsdl
index a4de7e0..d63fe2d 100644
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA.wsdl
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/SwA.wsdl
@@ -1,162 +1,162 @@
-
-
- BeSimpleSwaService
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ BeSimpleSwaService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEnc.wsdl b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/WsSecuritySigEnc.wsdl
similarity index 100%
rename from src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEnc.wsdl
rename to src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/WsSecuritySigEnc.wsdl
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPass.wsdl b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/WsSecurityUserPass.wsdl
similarity index 100%
rename from src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPass.wsdl
rename to src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/WsSecurityUserPass.wsdl
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/addBook.php b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/addBook.php
new file mode 100644
index 0000000..7a171b0
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/Fixtures/addBook.php
@@ -0,0 +1,11 @@
+ SOAP_1_1,
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
- 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
- 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
- 'cache_wsdl' => WSDL_CACHE_NONE,
- 'classmap' => array(
- 'base64Binary' => 'base64Binary',
- 'AttachmentRequest' => 'AttachmentRequest',
- ),
-);
-
-/*
- * Deploy "axis_services/sample-mtom.aar" to Apache Axis2 to get this
- * example to work.
- *
- * Apache Axis2 MTOM example.
- *
- */
-$sc = new BeSimpleSoapClient('MTOM.wsdl', $options);
-
-//var_dump($sc->__getFunctions());
-//var_dump($sc->__getTypes());
-
-try {
- $b64 = new base64Binary();
- $b64->_ = 'This is a test. :)';
- $b64->contentType = 'text/plain';
-
- $attachment = new AttachmentRequest();
- $attachment->fileName = 'test123.txt';
- $attachment->binaryData = $b64;
-
- var_dump($sc->attachment($attachment));
-
-} catch (Exception $e) {
- var_dump($e);
-}
-
-// var_dump(
-// $sc->__getLastRequestHeaders(),
-// $sc->__getLastRequest(),
-// $sc->__getLastResponseHeaders(),
-// $sc->__getLastResponse()
-// );
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/MtomAxisInteropTest.php b/src/BeSimple/SoapClient/Tests/AxisInterop/MtomAxisInteropTest.php
new file mode 100644
index 0000000..27d9e20
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/MtomAxisInteropTest.php
@@ -0,0 +1,51 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'base64Binary' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\base64Binary',
+ 'AttachmentRequest' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\AttachmentRequest',
+ ),
+ );
+
+ public function testAttachment()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/MTOM.wsdl', $this->options);
+
+ $b64 = new base64Binary();
+ $b64->_ = 'This is a test. :)';
+ $b64->contentType = 'text/plain';
+
+ $attachment = new AttachmentRequest();
+ $attachment->fileName = 'test123.txt';
+ $attachment->binaryData = $b64;
+
+ $this->assertEquals('File saved succesfully.', $sc->attachment($attachment));
+
+// $fileCreatedByServer = __DIR__.'/'.$attachment->fileName;
+// $this->assertEquals($b64->_, file_get_contents($fileCreatedByServer));
+// unlink($fileCreatedByServer);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA.php b/src/BeSimple/SoapClient/Tests/AxisInterop/SwA.php
deleted file mode 100644
index eaf1bc6..0000000
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA.php
+++ /dev/null
@@ -1,84 +0,0 @@
- SOAP_1_1,
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
- 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
- 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_SWA,
- 'cache_wsdl' => WSDL_CACHE_NONE,
-);
-
-/*
- * Deploy "axis_services/besimple-swa.aar" to Apache Axis2 to get this
- * example to work.
- *
- * Run ant to rebuild aar.
- *
- * Example based on:
- * http://axis.apache.org/axis2/java/core/docs/mtom-guide.html#a3
- * http://wso2.org/library/1675
- *
- * Doesn't work directly with ?wsdl served by Apache Axis!
- *
- */
-
-$sc = new BeSimpleSoapClient('SwA.wsdl', $options);
-
-//var_dump($sc->__getFunctions());
-//var_dump($sc->__getTypes());
-
-try {
- $file = new stdClass();
- $file->name = 'upload.txt';
- $file->data = 'This is a test text!';
- $result = $sc->uploadFile($file);
-
- var_dump(
- $result->return
- );
-
- $file = new stdClass();
- $file->name = 'upload.txt';
- $result = $sc->downloadFile($file);
-
- var_dump(
- $result->data
- );
-
- $file = new stdClass();
- $file->name = 'image.jpg'; // source: http://www.freeimageslive.com/galleries/light/pics/swirl3768.jpg
- $file->data = file_get_contents('image.jpg');
- $result = $sc->uploadFile($file);
-
- var_dump(
- $result->return
- );
-
- $crc32 = crc32($file->data);
-
- $file = new stdClass();
- $file->name = 'image.jpg';
- $result = $sc->downloadFile($file);
-
- file_put_contents('image2.jpg', $result->data);
-
-
- var_dump(
- crc32($result->data) === $crc32
- );
-
-} catch (Exception $e) {
- var_dump($e);
-}
-
-// var_dump(
-// $sc->__getLastRequestHeaders(),
-// $sc->__getLastRequest(),
-// $sc->__getLastResponseHeaders(),
-// $sc->__getLastResponse()
-// );
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/build.xml b/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/build.xml
index f5261ed..836bda8 100644
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/build.xml
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/build.xml
@@ -1,38 +1,38 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/resources/META-INF/services.xml b/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/resources/META-INF/services.xml
index 8b49f87..8bac2eb 100644
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/resources/META-INF/services.xml
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/SwA/resources/META-INF/services.xml
@@ -1,15 +1,15 @@
-
-
+
+
BeSimple test service for SwA.
- true
- besimple.service.BeSimpleSwaService
-
- urn:uploadFile
-
-
-
- urn:downloadFile
-
-
-
-
+ true
+ besimple.service.BeSimpleSwaService
+
+ urn:uploadFile
+
+
+
+ urn:downloadFile
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/SwaAxisInteropTest.php b/src/BeSimple/SoapClient/Tests/AxisInterop/SwaAxisInteropTest.php
new file mode 100644
index 0000000..4b9921f
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/SwaAxisInteropTest.php
@@ -0,0 +1,77 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_SWA,
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'downloadFile' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\downloadFile',
+ 'downloadFileResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\downloadFileResponse',
+ 'uploadFile' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFile',
+ 'uploadFileResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\uploadFileResponse',
+ ),
+ );
+
+ public function testUploadDownloadText()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $this->options);
+
+ $upload = new uploadFile();
+ $upload->name = 'upload.txt';
+ $upload->data = 'This is a test. :)';
+ $result = $sc->uploadFile($upload);
+
+ $this->assertEquals('File saved succesfully.', $result->return);
+
+ $download = new downloadFile();
+ $download->name = 'upload.txt';
+ $result = $sc->downloadFile($download);
+
+ $this->assertEquals($upload->data, $result->data);
+ }
+
+ public function testUploadDownloadImage()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $this->options);
+
+ $upload = new uploadFile();
+ $upload->name = 'image.jpg';
+ $upload->data = file_get_contents(__DIR__.'/Fixtures/image.jpg'); // source: http://www.freeimageslive.com/galleries/light/pics/swirl3768.jpg;
+ $result = $sc->uploadFile($upload);
+
+ $this->assertEquals('File saved succesfully.', $result->return);
+
+ $download = new downloadFile();
+ $download->name = 'image.jpg';
+ $result = $sc->downloadFile($download);
+
+ $this->assertEquals($upload->data, $result->data);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/TestCase.php b/src/BeSimple/SoapClient/Tests/AxisInterop/TestCase.php
new file mode 100644
index 0000000..eb57435
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/TestCase.php
@@ -0,0 +1,23 @@
+markTestSkipped(
+ 'The Axis server is not started on port 8080.'
+ );
+ }
+
+ curl_close($ch);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsAddressing.php b/src/BeSimple/SoapClient/Tests/AxisInterop/WsAddressing.php
deleted file mode 100644
index dacabcb..0000000
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/WsAddressing.php
+++ /dev/null
@@ -1,73 +0,0 @@
- SOAP_1_2,
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
- 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
-);
-
-/*
- * Deploy "axis_services/version2.aar" to Apache Axis2 to get this example to
- * work.
- *
- * To rebuild the "axis_services/version2.aar" the following steps need to be
- * done to build a working Apache Axis2 version service with SOAP session
- * enabled.
- *
- * 1) Go to $AXIS_HOME/samples/version and edit the following files:
- *
- * resources/META-INF/services.xml:
- *
- * ...
- *
- *
- * build.xml:
- * replace version.aar with version2.aar
- *
- * 2) Run ant build.xml in "$AXIS_HOME/samples/version"
- *
- */
-
-$sc = new BeSimpleSoapClient('http://localhost:8080/axis2/services/Version2?wsdl', $options);
-$soapKernel = $sc->getSoapKernel();
-$wsaFilter = new BeSimpleWsAddressingFilter();
-$soapKernel->registerFilter($wsaFilter);
-
-//var_dump($sc->__getFunctions());
-//var_dump($sc->__getTypes());
-
-try {
- $wsaFilter->setReplyTo(BeSimpleWsAddressingFilter::ENDPOINT_REFERENCE_ANONYMOUS);
- $wsaFilter->setMessageId();
-
- var_dump($sc->getVersion());
-
- $soapSessionId1 = $wsaFilter->getReferenceParameter('http://ws.apache.org/namespaces/axis2', 'ServiceGroupId');
- echo 'ID1: ' .$soapSessionId1 . PHP_EOL;
-
- $wsaFilter->addReferenceParameter('http://ws.apache.org/namespaces/axis2', 'axis2', 'ServiceGroupId', $soapSessionId1);
-
- var_dump($sc->getVersion());
-
- $soapSessionId2 = $wsaFilter->getReferenceParameter('http://ws.apache.org/namespaces/axis2', 'ServiceGroupId');
- echo 'ID2: ' . $soapSessionId2 . PHP_EOL;
-
- if ($soapSessionId1 == $soapSessionId2) {
- echo PHP_EOL;
- echo 'SOAP session worked :)';
- }
-} catch (Exception $e) {
- var_dump($e);
-}
-
-// var_dump(
-// $sc->__getLastRequestHeaders(),
-// $sc->__getLastRequest(),
-// $sc->__getLastResponseHeaders(),
-// $sc->__getLastResponse()
-// );
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsAddressingAxisInteropTest.php b/src/BeSimple/SoapClient/Tests/AxisInterop/WsAddressingAxisInteropTest.php
new file mode 100644
index 0000000..cf7308a
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/WsAddressingAxisInteropTest.php
@@ -0,0 +1,59 @@
+
+ * ...
+ *
+ *
+ * build.xml:
+ * replace version.aar with version2.aar
+ *
+ * 2) Run ant build.xml in "$AXIS_HOME/samples/version"
+ *
+ */
+
+use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
+use BeSimple\SoapClient\WsAddressingFilter as BeSimpleWsAddressingFilter;
+
+use BeSimple\SoapClient\Tests\AxisInterop\TestCase;
+
+class WsAddressingAxisInteropTest extends TestCase
+{
+ private $options = array(
+ 'soap_version' => SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ );
+
+ public function testSession()
+ {
+ $sc = new BeSimpleSoapClient('http://localhost:8080/axis2/services/Version2?wsdl', $this->options);
+ $soapKernel = $sc->getSoapKernel();
+ $wsaFilter = new BeSimpleWsAddressingFilter();
+ $soapKernel->registerFilter($wsaFilter);
+
+ $wsaFilter->setReplyTo(BeSimpleWsAddressingFilter::ENDPOINT_REFERENCE_ANONYMOUS);
+ $wsaFilter->setMessageId();
+
+ $version = $sc->getVersion();
+
+ $soapSessionId1 = $wsaFilter->getReferenceParameter('http://ws.apache.org/namespaces/axis2', 'ServiceGroupId');
+
+ $wsaFilter->addReferenceParameter('http://ws.apache.org/namespaces/axis2', 'axis2', 'ServiceGroupId', $soapSessionId1);
+
+ $version = $sc->getVersion();
+
+ $soapSessionId2 = $wsaFilter->getReferenceParameter('http://ws.apache.org/namespaces/axis2', 'ServiceGroupId');
+
+ $this->assertEquals($soapSessionId1, $soapSessionId2);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEnc.php b/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEnc.php
deleted file mode 100644
index d6a31fb..0000000
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEnc.php
+++ /dev/null
@@ -1,116 +0,0 @@
-';
-
-$options = array(
- 'soap_version' => SOAP_1_2,
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
- 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
-);
-
-/*
- * Deploy "axis_services/library-signencr.aar" to Apache Axis2 to get this
- * example to work.
- *
- * Links:
- * http://www.dcc.uchile.cl/~pcamacho/tutorial/web/xmlsec/xmlsec.html
- * http://www.aleksey.com/xmlsec/xmldsig-verifier.html
- *
- * Using code from axis example:
- * http://www.ibm.com/developerworks/java/library/j-jws5/index.html
- *
- * Download key tool to export private key
- * http://couchpotato.net/pkeytool/
- *
- * keytool -export -alias serverkey -keystore server.keystore -storepass nosecret -file servercert.cer
- * openssl x509 -out servercert.pem -outform pem -in servercert.pem -inform der
- *
- * keytool -export -alias clientkey -keystore client.keystore -storepass nosecret -file clientcert.cer
- * openssl x509 -out clientcert.pem -outform pem -in clientcert.pem -inform der
- * java -jar pkeytool.jar -exportkey -keystore client.keystore -storepass nosecret -keypass clientpass -rfc -alias clientkey -file clientkey.pem
- *
- * C:\Program Files\Java\jre6\bin\keytool -export -alias serverkey -keystore server.keystore -storepass nosecret -file servercert.cer
- * C:\xampp\apache\bin\openssl x509 -out servercert.pem -outform pem -in servercert.cer -inform der
- *
- * C:\Program Files\Java\jre6\bin\keytool -export -alias clientkey -keystore client.keystore -storepass nosecret -file clientcert.cer
- * C:\xampp\apache\bin\openssl x509 -out clientcert.pem -outform pem -in clientcert.cer -inform der
- * java -jar C:\axis2\pkeytool\pkeytool.jar -exportkey -keystore client.keystore -storepass nosecret -keypass clientpass -rfc -alias clientkey -file clientkey.pem
- *
- * build.properties:
- * server-policy=hash-policy-server.xml
- *
- * allows both text and digest!
- */
-
-class getBook {}
-class getBookResponse {}
-class getBooksByType {}
-class getBooksByTypeResponse {}
-class addBook {}
-class addBookResponse {}
-class BookInformation {}
-
-$options['classmap'] = array(
- 'getBook' => 'getBook',
- 'getBookResponse' => 'getBookResponse',
- 'getBooksByType' => 'getBooksByType',
- 'getBooksByTypeResponse' => 'getBooksByTypeResponse',
- 'addBook' => 'addBook',
- 'addBookResponse' => 'addBookResponse',
- 'BookInformation' => 'BookInformation',
-);
-
-$sc = new BeSimpleSoapClient('WsSecuritySigEnc.wsdl', $options);
-
-$wssFilter = new BeSimpleWsSecurityFilter();
-// user key for signature and encryption
-$securityKeyUser = new BeSimpleWsSecurityKey();
-$securityKeyUser->addPrivateKey(XmlSecurityKey::RSA_SHA1, 'clientkey.pem', true);
-$securityKeyUser->addPublicKey(XmlSecurityKey::RSA_SHA1, 'clientcert.pem', true);
-$wssFilter->setUserSecurityKeyObject($securityKeyUser);
-// service key for encryption
-$securityKeyService = new BeSimpleWsSecurityKey();
-$securityKeyService->addPrivateKey(XmlSecurityKey::TRIPLEDES_CBC);
-$securityKeyService->addPublicKey(XmlSecurityKey::RSA_1_5, 'servercert.pem', true);
-$wssFilter->setServiceSecurityKeyObject($securityKeyService);
-// TOKEN_REFERENCE_SUBJECT_KEY_IDENTIFIER | TOKEN_REFERENCE_SECURITY_TOKEN | TOKEN_REFERENCE_THUMBPRINT_SHA1
-$wssFilter->setSecurityOptionsSignature(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_SECURITY_TOKEN);
-$wssFilter->setSecurityOptionsEncryption(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_THUMBPRINT_SHA1);
-
-$soapKernel = $sc->getSoapKernel();
-$soapKernel->registerFilter($wssFilter);
-
-//var_dump($sc->__getFunctions());
-//var_dump($sc->__getTypes());
-
-try {
- $gb = new getBook();
- $gb->isbn = '0061020052';
- var_dump($sc->getBook($gb));
-
- $ab = new addBook();
- $ab->isbn = '0445203498';
- $ab->title = 'The Dragon Never Sleeps';
- $ab->author = 'Cook, Glen';
- $ab->type = 'scifi';
- var_dump($sc->addBook($ab));
-
- // getBooksByType("scifi");
-} catch (Exception $e) {
- var_dump($e);
-}
-
-//var_dump(
-// $sc->__getLastRequestHeaders(),
-// $sc->__getLastRequest(),
-// $sc->__getLastResponseHeaders(),
-// $sc->__getLastResponse()
-//);
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEncAxisInteropTest.php b/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEncAxisInteropTest.php
new file mode 100644
index 0000000..6e4f0d9
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecuritySigEncAxisInteropTest.php
@@ -0,0 +1,106 @@
+ SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBook',
+ 'addBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse',
+ 'BookInformation' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation',
+ ),
+ );
+
+ public function testSigEnc()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecuritySigEnc.wsdl', $this->options);
+
+ $wssFilter = new BeSimpleWsSecurityFilter();
+ // user key for signature and encryption
+ $securityKeyUser = new BeSimpleWsSecurityKey();
+ $securityKeyUser->addPrivateKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientkey.pem', true);
+ $securityKeyUser->addPublicKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientcert.pem', true);
+ $wssFilter->setUserSecurityKeyObject($securityKeyUser);
+ // service key for encryption
+ $securityKeyService = new BeSimpleWsSecurityKey();
+ $securityKeyService->addPrivateKey(XmlSecurityKey::TRIPLEDES_CBC);
+ $securityKeyService->addPublicKey(XmlSecurityKey::RSA_1_5, __DIR__.'/Fixtures/servercert.pem', true);
+ $wssFilter->setServiceSecurityKeyObject($securityKeyService);
+ // TOKEN_REFERENCE_SUBJECT_KEY_IDENTIFIER | TOKEN_REFERENCE_SECURITY_TOKEN | TOKEN_REFERENCE_THUMBPRINT_SHA1
+ $wssFilter->setSecurityOptionsSignature(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_SECURITY_TOKEN);
+ $wssFilter->setSecurityOptionsEncryption(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_THUMBPRINT_SHA1);
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ $this->assertInstanceOf('BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation', $result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ $this->assertTrue((bool) $sc->addBook($ab));
+
+ // getBooksByType("scifi");
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPass.php b/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPass.php
deleted file mode 100644
index 231f1e5..0000000
--- a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPass.php
+++ /dev/null
@@ -1,79 +0,0 @@
- SOAP_1_2,
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
- 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
-);
-
-/*
- * Deploy "axis_services/library-username-digest.aar" to Apache Axis2 to get
- * this example to work.
- *
- * Using code from axis example:
- * http://www.ibm.com/developerworks/java/library/j-jws4/index.html
- *
- * build.properties:
- * server-policy=hash-policy-server.xml
- *
- * allows both text and digest!
- */
-
-class getBook {}
-class getBookResponse {}
-class getBooksByType {}
-class getBooksByTypeResponse {}
-class addBook {}
-class addBookResponse {}
-class BookInformation {}
-
-$options['classmap'] = array(
- 'getBook' => 'getBook',
- 'getBookResponse' => 'getBookResponse',
- 'getBooksByType' => 'getBooksByType',
- 'getBooksByTypeResponse' => 'getBooksByTypeResponse',
- 'addBook' => 'addBook',
- 'addBookResponse' => 'addBookResponse',
- 'BookInformation' => 'BookInformation',
-);
-
-$sc = new BeSimpleSoapClient('WsSecurityUserPass.wsdl', $options);
-
-$wssFilter = new BeSimpleWsSecurityFilter(true, 600);
-$wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_TEXT);
-//$wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST );
-
-$soapKernel = $sc->getSoapKernel();
-$soapKernel->registerFilter($wssFilter);
-
-//var_dump($sc->__getFunctions());
-//var_dump($sc->__getTypes());
-
-try {
- $gb = new getBook();
- $gb->isbn = '0061020052';
- var_dump($sc->getBook($gb));
-
- $ab = new addBook();
- $ab->isbn = '0445203498';
- $ab->title = 'The Dragon Never Sleeps';
- $ab->author = 'Cook, Glen';
- $ab->type = 'scifi';
- var_dump($sc->addBook($ab));
-
- // getBooksByType("scifi");
-} catch (Exception $e) {
- var_dump($e);
-}
-
-//var_dump(
-// $sc->__getLastRequestHeaders(),
-// $sc->__getLastRequest(),
-// $sc->__getLastResponseHeaders(),
-// $sc->__getLastResponse()
-//);
diff --git a/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPassAxisInteropTest.php b/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPassAxisInteropTest.php
new file mode 100644
index 0000000..6ab2824
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/AxisInterop/WsSecurityUserPassAxisInteropTest.php
@@ -0,0 +1,96 @@
+ SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBook',
+ 'addBookResponse' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\addBookResponse',
+ 'BookInformation' => 'BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation',
+ ),
+ );
+
+ public function testUserPassText()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
+
+ $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
+ $wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_TEXT);
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ $this->assertInstanceOf('BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation', $result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ $this->assertTrue((bool) $sc->addBook($ab));
+
+ // getBooksByType("scifi");
+ }
+
+ public function testUserPassDigest()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
+
+ $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
+ $wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST );
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ $this->assertInstanceOf('BeSimple\SoapClient\Tests\AxisInterop\Fixtures\BookInformation', $result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ $this->assertTrue((bool) $sc->addBook($ab));
+
+ // getBooksByType("scifi");
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/AttachmentRequest.php b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/AttachmentRequest.php
new file mode 100644
index 0000000..8be17dc
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/AttachmentRequest.php
@@ -0,0 +1,7 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/SwA.wsdl b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/SwA.wsdl
new file mode 100644
index 0000000..46b14b7
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/SwA.wsdl
@@ -0,0 +1,162 @@
+
+
+ BeSimpleSwaService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/WsSecuritySigEnc.wsdl b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/WsSecuritySigEnc.wsdl
new file mode 100644
index 0000000..d329f1f
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/WsSecuritySigEnc.wsdl
@@ -0,0 +1,184 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/WsSecurityUserPass.wsdl b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/WsSecurityUserPass.wsdl
new file mode 100644
index 0000000..7d4b33f
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/WsSecurityUserPass.wsdl
@@ -0,0 +1,184 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/addBook.php b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/addBook.php
new file mode 100644
index 0000000..8d22133
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/Fixtures/addBook.php
@@ -0,0 +1,11 @@
+ SOAP_1_1,
@@ -28,12 +15,14 @@ $options = array(
'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
'cache_wsdl' => WSDL_CACHE_NONE,
'classmap' => array(
- 'base64Binary' => 'base64Binary',
- 'AttachmentRequest' => 'AttachmentRequest',
+ '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,
);
-$sc = new BeSimpleSoapClient('MTOM.wsdl', $options);
+$sc = new BeSimpleSoapClient('Fixtures/MTOM.wsdl', $options);
//var_dump($sc->__getFunctions());
//var_dump($sc->__getTypes());
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/MTOMServer.php b/src/BeSimple/SoapClient/Tests/ServerInterop/MTOMServer.php
index 5deee38..f86bda5 100644
--- a/src/BeSimple/SoapClient/Tests/ServerInterop/MTOMServer.php
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/MTOMServer.php
@@ -1,25 +1,11 @@
SOAP_1_1,
@@ -27,8 +13,8 @@ $options = array(
'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
'cache_wsdl' => WSDL_CACHE_NONE,
'classmap' => array(
- 'base64Binary' => 'base64Binary',
- 'AttachmentRequest' => 'AttachmentRequest',
+ 'base64Binary' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\base64Binary',
+ 'AttachmentRequest' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
),
);
@@ -38,16 +24,12 @@ class Mtom
{
$b64 = $attachment->binaryData;
- file_put_contents('test.txt', var_export(array(
- $attachment->fileName,
- $b64->_,
- $b64->contentType
- ), true));
+ file_put_contents(__DIR__.'/'.$attachment->fileName, $b64->_);
- return 'done';
+ return 'File saved succesfully.';
}
}
-$ss = new BeSimpleSoapServer('MTOM.wsdl', $options);
+$ss = new BeSimpleSoapServer(__DIR__.'/Fixtures/MTOM.wsdl', $options);
$ss->setClass('Mtom');
$ss->handle();
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/MtomServerInteropTest.php b/src/BeSimple/SoapClient/Tests/ServerInterop/MtomServerInteropTest.php
new file mode 100644
index 0000000..7277bed
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/MtomServerInteropTest.php
@@ -0,0 +1,44 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'base64Binary' => 'BeSimple\SoapClient\Tests\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.
+ );
+
+ public function testAttachment()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/MTOM.wsdl', $this->options);
+
+ $b64 = new base64Binary();
+ $b64->_ = 'This is a test. :)';
+ $b64->contentType = 'text/plain';
+
+ $attachment = new AttachmentRequest();
+ $attachment->fileName = 'test123.txt';
+ $attachment->binaryData = $b64;
+
+ $this->assertEquals('File saved succesfully.', $sc->attachment($attachment));
+
+ $fileCreatedByServer = __DIR__.'/'.$attachment->fileName;
+ $this->assertEquals($b64->_, file_get_contents($fileCreatedByServer));
+ unlink($fileCreatedByServer);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/SwAServer.php b/src/BeSimple/SoapClient/Tests/ServerInterop/SwAServer.php
new file mode 100644
index 0000000..337a0a0
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/SwAServer.php
@@ -0,0 +1,49 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_SWA,
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'downloadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\downloadFile',
+ 'downloadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\downloadFileResponse',
+ 'uploadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFile',
+ 'uploadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFileResponse',
+ ),
+);
+
+class SwA
+{
+ public function uploadFile(uploadFile $uploadFile)
+ {
+ file_put_contents(__DIR__.'/'.$uploadFile->name, $uploadFile->data);
+
+ $ufr = new uploadFileResponse();
+ $ufr->return = 'File saved succesfully.';
+
+ return $ufr;
+ }
+
+ public function downloadFile(downloadFile $downloadFile)
+ {
+ $dfr = new downloadFileResponse();
+ $dfr->data = file_get_contents(__DIR__.'/'.$downloadFile->name);
+
+ return $dfr;
+ }
+}
+
+$ss = new BeSimpleSoapServer(__DIR__.'/Fixtures/SwA.wsdl', $options);
+$ss->setClass('SwA');
+$ss->handle();
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/SwaClient.php b/src/BeSimple/SoapClient/Tests/ServerInterop/SwaClient.php
new file mode 100644
index 0000000..054fefe
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/SwaClient.php
@@ -0,0 +1,53 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_SWA,
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
+ 'classmap' => array(
+ 'downloadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\downloadFile',
+ 'downloadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\downloadFileResponse',
+ '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);
+
+try {
+
+ $upload = new uploadFile();
+ $upload->name = 'upload.txt';
+ $upload->data = 'This is a test. :)';
+ $result = $sc->uploadFile($upload);
+
+ var_dump($result);
+
+ $download = new downloadFile();
+ $download->name = 'upload.txt';
+ var_dump($sc->downloadFile($download));
+} catch (Exception $e) {
+ var_dump($e);
+}
+
+// var_dump(
+// $sc->__getLastRequestHeaders(),
+// $sc->__getLastRequest(),
+// $sc->__getLastResponseHeaders(),
+// $sc->__getLastResponse()
+// );
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/SwaServerInteropTest.php b/src/BeSimple/SoapClient/Tests/ServerInterop/SwaServerInteropTest.php
new file mode 100644
index 0000000..90f7fa0
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/SwaServerInteropTest.php
@@ -0,0 +1,64 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_SWA,
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'downloadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\downloadFile',
+ 'downloadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\downloadFileResponse',
+ '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.
+ );
+
+ public function testUploadDownloadText()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $this->options);
+
+ $upload = new uploadFile();
+ $upload->name = 'upload.txt';
+ $upload->data = 'This is a test. :)';
+ $result = $sc->uploadFile($upload);
+
+ $this->assertEquals('File saved succesfully.', $result->return);
+
+ $download = new downloadFile();
+ $download->name = 'upload.txt';
+ $result = $sc->downloadFile($download);
+
+ $this->assertEquals($upload->data, $result->data);
+ }
+
+ public function testUploadDownloadImage()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $this->options);
+
+ $upload = new uploadFile();
+ $upload->name = 'image.jpg';
+ $upload->data = file_get_contents(__DIR__.'/Fixtures/image.jpg'); // source: http://www.freeimageslive.com/galleries/light/pics/swirl3768.jpg;
+ $result = $sc->uploadFile($upload);
+
+ $this->assertEquals('File saved succesfully.', $result->return);
+
+ $download = new downloadFile();
+ $download->name = 'image.jpg';
+ $result = $sc->downloadFile($download);
+
+ $this->assertEquals($upload->data, $result->data);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/TestCase.php b/src/BeSimple/SoapClient/Tests/ServerInterop/TestCase.php
new file mode 100644
index 0000000..b0f1f40
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/TestCase.php
@@ -0,0 +1,29 @@
+markTestSkipped(
+ 'The PHP cli webserver is not available with PHP 5.3.'
+ );
+ }
+
+ $ch = curl_init('http://localhost:8081/');
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+ curl_setopt($ch, CURLOPT_HEADER, true);
+ curl_setopt($ch, CURLOPT_NOBODY, true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ if (curl_exec($ch) === false) {
+ $this->markTestSkipped(
+ 'The PHP webserver is not started on port 8081.'
+ );
+ }
+
+ curl_close($ch);
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServer.php b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServer.php
new file mode 100644
index 0000000..c8b01c6
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServer.php
@@ -0,0 +1,82 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBook',
+ 'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
+ 'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
+ ),
+);
+
+class WsSecuritySigEncServer
+{
+ public function getBook(getBook $gb)
+ {
+ $bi = new BookInformation();
+ $bi->isbn = $gb->isbn;
+ $bi->title = 'title';
+ $bi->author = 'author';
+ $bi->type = 'scifi';
+
+ $br = new getBookResponse();
+ $br->getBookReturn = $bi;
+
+ return $br;
+ }
+
+ public function addBook(addBook $ab)
+ {
+ $abr = new addBookResponse();
+ $abr->addBookReturn = true;
+
+ return $abr;
+ }
+}
+
+$ss = new BeSimpleSoapServer(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $options);
+
+$wssFilter = new BeSimpleWsSecurityFilter();
+
+// user key for signature and encryption
+$securityKeyUser = new BeSimpleWsSecurityKey();
+$securityKeyUser->addPrivateKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/serverkey.pem', true);
+$securityKeyUser->addPublicKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/servercert.pem', true);
+$wssFilter->setUserSecurityKeyObject($securityKeyUser);
+// service key for encryption
+$securityKeyService = new BeSimpleWsSecurityKey();
+$securityKeyService->addPrivateKey(XmlSecurityKey::TRIPLEDES_CBC);
+$securityKeyService->addPublicKey(XmlSecurityKey::RSA_1_5, __DIR__.'/Fixtures/clientcert.pem', true);
+$wssFilter->setServiceSecurityKeyObject($securityKeyService);
+// TOKEN_REFERENCE_SUBJECT_KEY_IDENTIFIER | TOKEN_REFERENCE_SECURITY_TOKEN | TOKEN_REFERENCE_THUMBPRINT_SHA1
+$wssFilter->setSecurityOptionsSignature(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_SECURITY_TOKEN);
+$wssFilter->setSecurityOptionsEncryption(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_THUMBPRINT_SHA1);
+
+$soapKernel = $ss->getSoapKernel();
+$soapKernel->registerFilter($wssFilter);
+
+$ss->setClass('WsSecuritySigEncServer');
+$ss->handle();
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerClient.php b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerClient.php
new file mode 100644
index 0000000..6c7fe1d
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerClient.php
@@ -0,0 +1,83 @@
+ SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBook',
+ '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);
+
+//var_dump($sc->__getFunctions());
+//var_dump($sc->__getTypes());
+
+try {
+ $wssFilter = new BeSimpleWsSecurityFilter();
+ // user key for signature and encryption
+ $securityKeyUser = new BeSimpleWsSecurityKey();
+ $securityKeyUser->addPrivateKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientkey.pem', true);
+ $securityKeyUser->addPublicKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientcert.pem', true);
+ $wssFilter->setUserSecurityKeyObject($securityKeyUser);
+ // service key for encryption
+ $securityKeyService = new BeSimpleWsSecurityKey();
+ $securityKeyService->addPrivateKey(XmlSecurityKey::TRIPLEDES_CBC);
+ $securityKeyService->addPublicKey(XmlSecurityKey::RSA_1_5, __DIR__.'/Fixtures/servercert.pem', true);
+ $wssFilter->setServiceSecurityKeyObject($securityKeyService);
+ // TOKEN_REFERENCE_SUBJECT_KEY_IDENTIFIER | TOKEN_REFERENCE_SECURITY_TOKEN | TOKEN_REFERENCE_THUMBPRINT_SHA1
+ $wssFilter->setSecurityOptionsSignature(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_SECURITY_TOKEN);
+ $wssFilter->setSecurityOptionsEncryption(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_THUMBPRINT_SHA1);
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ var_dump($result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ var_dump($sc->addBook($ab));
+
+} catch (Exception $e) {
+ var_dump($e);
+}
+
+// var_dump(
+// $sc->__getLastRequestHeaders(),
+// $sc->__getLastRequest(),
+// $sc->__getLastResponseHeaders(),
+// $sc->__getLastResponse()
+// );
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerInteropTest.php b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerInteropTest.php
new file mode 100644
index 0000000..7cbbef4
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerInteropTest.php
@@ -0,0 +1,73 @@
+ SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBook',
+ '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.
+ );
+
+ public function testSigEnc()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecuritySigEnc.wsdl', $this->options);
+
+ $wssFilter = new BeSimpleWsSecurityFilter();
+ // user key for signature and encryption
+ $securityKeyUser = new BeSimpleWsSecurityKey();
+ $securityKeyUser->addPrivateKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientkey.pem', true);
+ $securityKeyUser->addPublicKey(XmlSecurityKey::RSA_SHA1, __DIR__.'/Fixtures/clientcert.pem', true);
+ $wssFilter->setUserSecurityKeyObject($securityKeyUser);
+ // service key for encryption
+ $securityKeyService = new BeSimpleWsSecurityKey();
+ $securityKeyService->addPrivateKey(XmlSecurityKey::TRIPLEDES_CBC);
+ $securityKeyService->addPublicKey(XmlSecurityKey::RSA_1_5, __DIR__.'/Fixtures/servercert.pem', true);
+ $wssFilter->setServiceSecurityKeyObject($securityKeyService);
+ // TOKEN_REFERENCE_SUBJECT_KEY_IDENTIFIER | TOKEN_REFERENCE_SECURITY_TOKEN | TOKEN_REFERENCE_THUMBPRINT_SHA1
+ $wssFilter->setSecurityOptionsSignature(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_SECURITY_TOKEN);
+ $wssFilter->setSecurityOptionsEncryption(BeSimpleWsSecurityFilter::TOKEN_REFERENCE_THUMBPRINT_SHA1);
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ $this->assertInstanceOf('BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation', $result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ $this->assertTrue((bool) $sc->addBook($ab));
+
+ // getBooksByType("scifi");
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServer.php b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServer.php
new file mode 100644
index 0000000..8a2e2dc
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServer.php
@@ -0,0 +1,78 @@
+ SOAP_1_1,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'cache_wsdl' => WSDL_CACHE_NONE,
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBook',
+ 'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
+ 'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
+ ),
+);
+
+class Auth
+{
+ public static function usernamePasswordCallback($user)
+ {
+ if ($user == 'libuser') {
+ return 'books';
+ }
+
+ return null;
+ }
+}
+
+class WsSecurityUserPassServer
+{
+ public function getBook(getBook $gb)
+ {
+ $bi = new BookInformation();
+ $bi->isbn = $gb->isbn;
+ $bi->title = 'title';
+ $bi->author = 'author';
+ $bi->type = 'scifi';
+
+ $br = new getBookResponse();
+ $br->getBookReturn = $bi;
+
+ return $br;
+ }
+
+ public function addBook(addBook $ab)
+ {
+ $abr = new addBookResponse();
+ $abr->addBookReturn = true;
+
+ return $abr;
+ }
+}
+
+$ss = new BeSimpleSoapServer(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $options);
+
+$wssFilter = new BeSimpleWsSecurityFilter();
+$wssFilter->setUsernamePasswordCallback(array('Auth', 'usernamePasswordCallback'));
+
+$soapKernel = $ss->getSoapKernel();
+$soapKernel->registerFilter($wssFilter);
+
+$ss->setClass('WsSecurityUserPassServer');
+$ss->handle();
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerClient.php b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerClient.php
new file mode 100644
index 0000000..b69b3d9
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerClient.php
@@ -0,0 +1,68 @@
+ SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'trace' => true, // enables use of the methods SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse and SoapClient->__getLastResponseHeaders
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBook',
+ '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);
+
+//var_dump($sc->__getFunctions());
+//var_dump($sc->__getTypes());
+
+try {
+ $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
+ $wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST);
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ var_dump($result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ var_dump($sc->addBook($ab));
+
+} catch (Exception $e) {
+ var_dump($e);
+}
+
+// var_dump(
+// $sc->__getLastRequestHeaders(),
+// $sc->__getLastRequest(),
+// $sc->__getLastResponseHeaders(),
+// $sc->__getLastResponse()
+// );
diff --git a/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerInteropTest.php b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerInteropTest.php
new file mode 100644
index 0000000..4030507
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerInteropTest.php
@@ -0,0 +1,86 @@
+ SOAP_1_2,
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
+ 'classmap' => array(
+ 'getBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBook',
+ 'getBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBookResponse',
+ 'getBooksByType' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByType',
+ 'getBooksByTypeResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\getBooksByTypeResponse',
+ 'addBook' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBook',
+ '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.
+ );
+
+ public function testUserPassText()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
+
+ $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
+ $wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_TEXT);
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ $this->assertInstanceOf('BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation', $result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ $this->assertTrue((bool) $sc->addBook($ab));
+
+ // getBooksByType("scifi");
+ }
+
+ public function testUserPassDigest()
+ {
+ $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
+
+ $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
+ $wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST );
+
+ $soapKernel = $sc->getSoapKernel();
+ $soapKernel->registerFilter($wssFilter);
+
+ $gb = new getBook();
+ $gb->isbn = '0061020052';
+ $result = $sc->getBook($gb);
+ $this->assertInstanceOf('BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation', $result->getBookReturn);
+
+ $ab = new addBook();
+ $ab->isbn = '0445203498';
+ $ab->title = 'The Dragon Never Sleeps';
+ $ab->author = 'Cook, Glen';
+ $ab->type = 'scifi';
+
+ $this->assertTrue((bool) $sc->addBook($ab));
+
+ // getBooksByType("scifi");
+ }
+}
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/bin/axis.sh b/src/BeSimple/SoapClient/Tests/bin/axis.sh
new file mode 100644
index 0000000..a6d9ff0
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/bin/axis.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR
+
+VERSION_AXIS=1.5.1
+ZIP_AXIS=axis2-$VERSION_AXIS-bin.zip
+if [[ "$VERSION_AXIS" > "1.5.1" ]]; then
+ PATH_AXIS=http://archive.apache.org/dist/axis/axis2/java/core/$VERSION_AXIS/$ZIP_AXIS
+else
+ PATH_AXIS=http://archive.apache.org/dist/ws/axis2/${VERSION_AXIS//./_}/$ZIP_AXIS
+fi
+
+if [ ! -f "$DIR/$ZIP_AXIS" ]; then
+ curl -O -s $PATH_AXIS
+fi
+
+VERSION_RAMPART=1.5
+ZIP_RAMPART=rampart-dist-$VERSION_RAMPART-bin.zip
+PATH_RAMPART=http://archive.apache.org/dist/axis/axis2/java/rampart/$VERSION_RAMPART/$ZIP_RAMPART
+
+if [ ! -f "$DIR/$ZIP_RAMPART" ]; then
+ curl -O -s $PATH_RAMPART
+fi
+
+unzip -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
+
+cp -r $DIR/../AxisInterop/axis_services/* $AXIS_DIR/repository/services
+
+$AXIS_DIR/bin/axis2server.sh&
+
+echo "Waiting until Axis is ready on port 8080"
+while [[ -z `curl -s 'http://localhost:8080' ` ]]
+do
+ echo -n "."
+ sleep 2s
+done
+
+echo "Axis is up"
\ No newline at end of file
diff --git a/src/BeSimple/SoapClient/Tests/bin/phpwebserver.sh b/src/BeSimple/SoapClient/Tests/bin/phpwebserver.sh
new file mode 100644
index 0000000..682f802
--- /dev/null
+++ b/src/BeSimple/SoapClient/Tests/bin/phpwebserver.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR
+
+php -S localhost:8081 -t "$DIR/.."&
+
+echo "Waiting until PHP webserver is ready on port 8081"
+while [[ -z `curl -s 'http://localhost:8081' ` ]]
+do
+ echo -n "."
+ sleep 2s
+done
+
+echo "PHP webserver is up"
\ No newline at end of file