Issue Details (XML | Word | Printable)

Key: ZF-4117
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Benjamin Eberlei
Reporter: Thomas Gelf
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Soap_AutoDiscover is using hardcoded http schema

Created: 29/Aug/08 07:38 AM   Updated: 13/Nov/08 02:10 PM   Resolved: 27/Oct/08 09:05 AM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Soap_Server, Zend_Soap_Wsdl
Affects Version/s: 1.6.0RC3, 1.6.0, 1.6.1, 1.6.2, 1.7 Preview Release
Fix Version/s: 1.7.0

Time Tracking:
Not Specified

File Attachments: 1. Text File AutoDiscoverSetUri.php.patch (7 kB)
2. Text File AutoDiscoverTestSetUri.php.patch (0.8 kB)
3. Text File Zend_Soap_AutoDiscover.https.patch (0.7 kB)
4. Text File Zend_Soap_AutoDiscover.targetNamespace.patch (4 kB)
5. Text File Zend_Soap_AutoDiscover.uri.patch (1 kB)

Issue Links:
Duplicate
 


 Description  « Hide

Zend_Soap_AutoDiscover is using Zend_Uri::factory('http://' ... to create a services uri - it should at least be able to correctly discover https.

Kind regards,
Thomas Gelf



Thomas Gelf added a comment - 29/Aug/08 07:41 AM

You can find a possible way to fix this issue in the attached patch file.

Cheers,
Thomas


Marcus Welz added a comment - 29/Aug/08 10:19 AM

Would it make sense to allow for more flexibility with setting the Uri? For cases of mod_rewrite, in context of MVC, etc. Patch attached.

Thanks!


Thomas Gelf added a comment - 29/Aug/08 04:16 PM

Full ack, absolutely great!


Apaella added a comment - 03/Sep/08 03:30 AM

I ran in the same problem. Same solution


Marcus Welz added a comment - 12/Sep/08 01:27 PM

Zend_Soap_AutoDiscover.targetNamespace.patch allows for setting the soap endpoint url separately from the target namespace.


Thomas Gelf added a comment - 16/Sep/08 06:25 AM

Like for Ing. Jitka Darbujanova in ZF-4172 this issue is a showstopper for me, Zend_Soap_AutoDiscover disallows HTTPS and setting uri / location / whatever on a personal choice is impossible. The patches attached to this bug report are easy to understand and shouldn't break anything - it would be great if someone could take care of this ticket. Issue is still there in 1.6.1.

Best regards,
Thomas Gelf


Thomas Gelf added a comment - 16/Sep/08 12:27 PM

Oops! I somehow managed it to toggle assignment, sorry.
I'll let it be reassigned automatically...


Benjamin Eberlei added a comment - 07/Oct/08 12:47 AM

Sorry, all three patches are bogus..

The first one is just a hack to solve the HTTPS problem, the second and third ones ignore the setFunction alltogether. None provides unittests and documentation changes.

Also the one with setUri (Zend_Soap_Autodiscover.uri.php) has the problem that when setClass is called BEFORE setUri, the uri setting is ignored. This is not desired behaviour since its common expectation that the setter functions of webservice objects (like SOAPServer) only begin to act on calling $server->handle();

I have attached a patch that allows changing the default wsdl location uri only by constructor, to handle the problem described in the above paragraph. I have added a unittest to check for the changed webservice url and a proposed change to the documentation.

To allow for a setUri function to be accessible for the public scope, underlying changes to the WSDL component have to be done. Therefore my setUri function is just private for the time being, hoping that the WSDL component will be refactored someday to be more flexible.


Benjamin Eberlei added a comment - 07/Oct/08 12:48 AM
  • add private setUri function (due to problems in communication with WSDL component)
  • add new variable in constructor taking Zend_Uri|string and saving to $this->_uri
  • change setClass to test for $this->_uri
  • change setFunction to test for $this->_uri

Benjamin Eberlei added a comment - 07/Oct/08 12:50 AM
  • Add Test-Case for AutoDiscover setting Uri via constructor

The corresponding file to this comments are AutoDiscoverTestSetUri.php.patch and AutoDiscoverSetUri.php.patch


Benjamin Eberlei added a comment - 26/Oct/08 11:14 AM

Fixed in Trunk via second constructor parameter $uri or function setUri($uri).


Thomas Gelf added a comment - 27/Oct/08 05:58 AM

Thank you for fixing this, setUri() is a great addition. However my initial bug report regarded hardcoded http schema and autodetection. My proposed patch is not a hack, schema detection is done the same way in other parts of the Zend Framework (Controller, OpenID...). And it requires no new documentation as it fixes existing behaviour conforming to what a developer would expect from an "autodiscover" component.

Not using HTTPS is not an option for most webservices today, and if there is an autodetection component it should also detect wheter I'm running HTTPS or not. I do NOT want to have to either do schema detection in my controllers and I do NOT want to hardcode / configure URIs in my application. Schema detection should work out of the box - and adding port detection for non-standard ports would also be a nice-to-have feature.

Adding schema detection from my very first patch to your setUri() function would solve this, adding port detection (like Zend_OpenId::selfUrl()) would be a nice addition.

Best regards,
Thomas Gelf

NB: Sorry for impudently reopening this issue


Benjamin Eberlei added a comment - 27/Oct/08 08:51 AM

i am sorry, misunderstood the issue (overstepped it). I'll fix the HTTPS issue right away.


Benjamin Eberlei added a comment - 27/Oct/08 09:05 AM

Fixed detection of HTTPS schema in trunk


Wil Sinclair added a comment - 13/Nov/08 02:10 PM

Changing issues in preparation for the 1.7.0 release.