-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Added NTLM authentication support to Zend\Soap\Client\DotNet. #3202
Added NTLM authentication support to Zend\Soap\Client\DotNet. #3202
Conversation
|
||
// @codingStandardsIgnoreStart | ||
|
||
namespace Zend\Soap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of use braces end the statement with a ;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use different files for different namespaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not possible, as this trick is needed to "mock" out the call_user_func call
in Zend\Soap\Client. Inside Zend\Soap\Client::_doRequest, a call is made
as call_user_func(array($client,'SoapClient::__doRequest')...). There is
absolutely no way I can mock this out from PHPUnit. I am forced to resort
to defining call_user_func inside the namespace in order to intercept the
call and make sure the base method is called when NTLM authentication is
not used.
Jessie
On Tue, Dec 11, 2012 at 3:10 PM, Maks [email protected] wrote:
In tests/ZendTest/Soap/Client/DotNetTest.php:
@@ -0,0 +1,262 @@
+<?php
+/**
- * Zend Framework (http:https://framework.zend.com/)
- * @link http:https://github.com/zendframework/zf2 for the canonical source repository
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http:https://www.zend.com)
- * @license http:https://framework.zend.com/license/new-bsd New BSD License
- * @Package Zend_Soap
- */
+
+// @codingStandardsIgnoreStart
+
+namespace Zend\SoapUse different files for different namespaces
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/3202/files#r2383929.
/** | ||
* Returns the cURL client that is being used. | ||
* | ||
* @return \Zend\Http\Client\Adapter\Curl The cURL client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annotation value can be simply "CurlClient"; they're resolved based on imports and/or current namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, wasn't sure on the coding standard requirement in this area.
Thanks, Matthew!
Jessie Hernandez
On Tue, Dec 11, 2012 at 3:28 PM, weierophinney [email protected]:
In library/Zend/Soap/Client/DotNet.php:
$curlClient->write('POST', $uri, 1.1, $headers, $request);
$response = HttpResponse::fromString($curlClient->read());
$curlClient->close();
// Save headers
$this->lastRequestHeaders = $this->flattenHeaders($headers);
$this->lastResponseHeaders = $response->getHeaders()->toString();
// Return only the XML body
return $response->getBody();
- }
- /**
\* Returns the cURL client that is being used.
*
\* @return \Zend\Http\Client\Adapter\Curl The cURL client.
annotation value can be simply "CurlClient"; they're resolved based on
imports and/or current namespace.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/3202/files#r2384187.
Seems this has broken Travis Tests
|
Works fine under PHPUnit 3.7.10 using Zend Server CE's current PHP version (5.3.14). I'm going to compile 5.4.8 and see if that is the culprit. $ ~/projects/phpunit/usr/local/zend/bin/phpunit ZendTest/Soap Configuration read from /Users/jessie/projects/zf2/tests/phpunit.xml.dist SS................................I............................ 63 / 165 ( 38%) Time: 2 seconds, Memory: 10.00Mb OK, but incomplete or skipped tests! |
I'm happy to report that the segfault has nothing to do with my changes. I removed all three files (DotNet.php, calc_user_func.php and MockCallUserFunc.php) and I still get the segfault (this was using PHP 5.4.9). Here's the output: jessie-hernandezs-macbook-pro:tests jessie$ find ZendTest/Soap $ phpunit ZendTest/Soap Configuration read from /Users/jessie/projects/zf2/tests/phpunit.xml.dist SS.........................Segmentation fault: 11 |
After adding the --stderr option to PHPUnit and increasing the ulimit, it all worked (I stopped getting the segfault on the codebase before my changes and after them): $ find ZendTest/Soap $ phpunit --stderr ZendTest/Soap Configuration read from /Users/jessie/projects/zf2/tests/phpunit.xml.dist SS................................I............................ 63 / 165 ( 38%) Time: 0 seconds, Memory: 8.50Mb OK, but incomplete or skipped tests! |
- Moved call_user_func override into separate file - Moved MockCallUserFunc class into separate class file - Passes php-cs-fixer, and tests run
This commit adds NTLM authentication support to the DotNet SOAP client, which I needed for a project I'm working on at my job. I'm a newbie to git (I use SVN for the most part), so if I did anything wrong just let me know. I ran the tests successfully locally, though I had to change a $this->once() call in the test to $this->any(), as I was getting a Bus error from PHPUnit (it does not happen on the test suite I have at work).
Comments/suggestions welcome.