Skip to content

enh #94, added support for document/literal WSDL in generator #2140

Merged
merged 6 commits into from Jan 30, 2014

4 participants

@nineinchnick

Resolves issue #94. Based on Zend 2.0 Soap Autodiscover class.

RPC/encoded is still the default, but Document/literal can be enabled by setting new properties:

  • operationBodyStyle
  • bindingStyle
  • bindingTransport

Usage:

    public function actions() {
        return array(
            'wsdl'=>array(
                'class'=>'CWebServiceAction',
                'serviceOptions' => array(
                    'generatorConfig' => array(
                        'class' => 'CWsdlGenerator',
                        'operationBodyStyle'=>array('use'=>'literal'),
                        'bindingStyle'=>'document',
                    ),
                ),
            ),
        );
    }
@nineinchnick nineinchnick enh #94, added support for document/literal WSDL in generator, inspir…
…ed by Zend 2.0 Soap Autodiscover class
a61b6de
@nineinchnick nineinchnick enh #94, added a wrapper in CWebService handling method arguments and…
… response in document mode
98fe65f
@nineinchnick nineinchnick reopened this Feb 21, 2013
@samdark
Yii Software LLC member
samdark commented May 27, 2013

@nineinchnick I've just merged #2062, can you check it?

@nineinchnick nineinchnick Merge branch 'master' into 94-document-literal-wsdl
Conflicts:
	CHANGELOG
	framework/web/services/CWsdlGenerator.php
3ecab01
@marcovtwout

You could use the following PHP defines instead of doing string comparisons:

SOAP_RPC
SOAP_DOCUMENT

SOAP_ENCODED
SOAP_LITERAL

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.

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'

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.

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.

You are right, thanks for convincing me. Now I don't even know why I was opposing this. Fixed in commit 3c94a7a.

Details matter :) Thanks for updating!

@nineinchnick

Does it need tests to be accepted? I'm using this code in production. I could write tests based on that. Same for #89.

@cebe cebe was assigned Jan 30, 2014
@nineinchnick

Just merged with master, ready for merge.

@cebe cebe added a commit that referenced this pull request Jan 30, 2014
@cebe cebe Merge PR #2140 branch '94-document-literal-wsdl' of https://github.co…
…m/nineinchnick/yii into nineinchnick-94-document-literal-wsdl

* '94-document-literal-wsdl' of https://github.com/nineinchnick/yii:
  use consts in place of 'rpc' and 'encoded' for operationBodyStyle and bindingStyle properties
  enh #94, added a wrapper in CWebService handling method arguments and response in document mode
  enh #94, added support for document/literal WSDL in generator, inspired by Zend 2.0 Soap Autodiscover class
990cce4
@cebe cebe merged commit f1abb79 into yiisoft:master Jan 30, 2014
@cebe
Yii Software LLC member
cebe commented Jan 30, 2014

Merged. Thanks!

@nineinchnick nineinchnick deleted the nineinchnick:94-document-literal-wsdl branch Jan 30, 2014
@nineinchnick nineinchnick referenced this pull request Jan 31, 2014
Merged

fix wsdl generator #3192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.