forked from yiisoft/yii
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh yiisoft#94, added support for document/literal WSDL in generator,…
… inspired by Zend 2.0 Soap Autodiscover class
- Loading branch information
1 parent
2370a9e
commit a61b6de
Showing
2 changed files
with
134 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a61b6de
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.
You could use the following PHP defines instead of doing string comparisons:
SOAP_RPC
SOAP_DOCUMENT
SOAP_ENCODED
SOAP_LITERAL
a61b6de
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.
I don't think so, because I put bindingStyle and operationBodyStyle directly in the WSDL and bindingStyle needs to be a string of either 'rpc' or 'document' and operationBodyStyle's 'use' key neends to be either 'encoded' or 'literal' .
I've tried to search over php docs to see the usage of those constants but couldn't find none.
a61b6de
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.
These core PHP constants are defined here: http://php.net/manual/en/soap.constants.php
Maybe it's good to define and use your own consts in this file, for example:
STYLE_RPC = 'rpc'
STYLE_DOCUMENT = 'document'
USE_ENCODED = 'encoded'
USE_LITERAL = 'literal'
a61b6de
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.
Yeah, and they are defined as integers. I really don't think that using a constant instead of a string is much different. There are only two variants. There won't be more, there are only legacy SOAP apps left and everybody is doing the new stuff as RESTful. Besides, if we would use document/literal as the defaults probably no one would wan't to change it back to rpc/encoded.
Anyway, I just hope this gets merged as it is.
a61b6de
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.
When you are using (lots of) comparisons such as "if ($bindingStyle == 'rpc'), in my opinoin it is much cleaner to use "if ($bindingStyle == self::STYLE_RPC)"
It doesn't really matter if there are two options or ten, using these consts softly restricts the possible values, and it is less error prone.
a61b6de
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.
You are right, thanks for convincing me. Now I don't even know why I was opposing this. Fixed in commit 3c94a7a.
a61b6de
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.
Details matter :) Thanks for updating!