From 64002c61d2dcd7e784b41e91ac6507ab7bc2f335 Mon Sep 17 00:00:00 2001 From: Andreas Schamberger Date: Sun, 22 Apr 2012 18:10:21 +0200 Subject: [PATCH] server interop test --- tests/ServerInterop/MTOM.php | 61 ++++++++++++++++++++ tests/ServerInterop/MTOM.wsdl | 89 ++++++++++++++++++++++++++++++ tests/ServerInterop/MTOMServer.php | 53 ++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 tests/ServerInterop/MTOM.php create mode 100644 tests/ServerInterop/MTOM.wsdl create mode 100644 tests/ServerInterop/MTOMServer.php diff --git a/tests/ServerInterop/MTOM.php b/tests/ServerInterop/MTOM.php new file mode 100644 index 0000000..4f815b9 --- /dev/null +++ b/tests/ServerInterop/MTOM.php @@ -0,0 +1,61 @@ + 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', + ), +); + +$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/tests/ServerInterop/MTOM.wsdl b/tests/ServerInterop/MTOM.wsdl new file mode 100644 index 0000000..7772015 --- /dev/null +++ b/tests/ServerInterop/MTOM.wsdl @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ServerInterop/MTOMServer.php b/tests/ServerInterop/MTOMServer.php new file mode 100644 index 0000000..5deee38 --- /dev/null +++ b/tests/ServerInterop/MTOMServer.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_MTOM, + 'cache_wsdl' => WSDL_CACHE_NONE, + 'classmap' => array( + 'base64Binary' => 'base64Binary', + 'AttachmentRequest' => 'AttachmentRequest', + ), +); + +class Mtom +{ + public function attachment(AttachmentRequest $attachment) + { + $b64 = $attachment->binaryData; + + file_put_contents('test.txt', var_export(array( + $attachment->fileName, + $b64->_, + $b64->contentType + ), true)); + + return 'done'; + } +} + +$ss = new BeSimpleSoapServer('MTOM.wsdl', $options); +$ss->setClass('Mtom'); +$ss->handle();