您的位置:首页 > 编程语言 > PHP开发

Zend_Soap_AutoDiscover自动生成wsdl

2011-08-07 09:38 260 查看
Zend_Soap_AutoDiscover虽然可以自动生成wsdl,可以通过标准注释,来生成一些wsdl属性。还提供了多种Strategy。但是这些还是无法自动生成复杂的wsdl或者不会使用。在网上,发现了一个zend framework推荐的,自动生成wsdl的Strategy。

连接:http://framework.zend.com/wiki/display/ZFPROP/Zend_Soap_Wsdl_Strategy_DefaultComplexType%2B-%2BImprovement%2Bfor%2Bthe%2BAutoDiscover%2B-%2BJeannie%2BBOFFEL

1. Overview

Improvement of Zend_Soap_Wsdl_Strategy_DefaultComplexType goal is to give a real possibility to describe XSD for auto-generated WSDL via PHP Document in commentaries without breaking existing code using current version.

The goal is not to give a full support of XSD technology. But at least, we could try to make possible usage of 80% or 90% of basic component of XSD. Most used one. I think this goal is reach with current version.

2. References

Zend Framework AutoDiscovery

3. Component Requirements, Constraints, and Acceptance Criteria

This component will add support for describing XSD of auto-generated WSDL through the use of the AutoDiscovery.
This component will replace existing Zend_Soap_Wsdl_Strategy_DefaultComplexType component.
This component will generate same XSD+WSDL than previous component if new features are not used (not breaking code).
This component will reserve php Doc tag @xsd for any action linked to new features.
This component will not validate the XSD generated. Meanning we don't prevent user from doing wrong XSD by adding unexisting attribute to an element for example.
This component will not be exhaustive and will not support all XSD features immediately.

4. Dependencies on Other Framework Components

Zend_Soap

5. Theory of Operation

The component is instantiated by AutoDiscovery system of Zend Framework when trying to auto-generate a WSDL+XSD via reflection on the code.

6. Milestones / Tasks

Feature Request 1: I tried to add support for use ref attributes in element tag,

but the generated soap response with soap server is not compatible for now.

WSDL+XSD are correct, but response will not match the auto-generated XSD...

So use only complexType with call to them with style attribute.
Feature Request 2: Add support for SOA design, meaning improve again AutoDiscovery, improve also Zend_Soap_Wsdl which has a bug in its way to genrate the XML, improve Zend_Soap_Server because register exception system is not really usable as is with idea
of SOA design for example. However, it's also possible to decide to not use this support for now.

I implemented already almost everything needed, except error handler, not yet sure about the design.
Milestone #: [DONE] Design
Milestone #: [DONE] Proof of concept by implement new complex type strategy
Milestone #: [DONE] Start support of based most use tag of XSD, such as sequence, choice, all
Milestone #: [DONE] Start support of basical restriction such as minOccurs, maxOccurs
Milestone #: [DONE] Start support of simpleType through new class, like for complexType
Milestone #: [DONE] Start support of more complex restriction type such as pattern, enumeration through simpleType support
Milestone #: [DONE] Start support of union and list through simpleType support
Milestone 1: Working prototype checked into the incubator supporting use cases #1.
Milestone 2: Unit tests exist, work, and are checked into SVN.
Milestone 3: Initial documentation exists.

7. Class Index

Zend_Soap_Wsdl_Strategy_DefaultComplexType

8. Use Cases

To test validation of schema against xml response from a PHP SoapServer, for example with SoapUI, please generate in literal mode. Do not try to generate in document style instead of RPC.

UC-01
Basic exemple with 2 simpleType, 3 complexType, 1 function

?
        
$details
->addBrotherDetail(
new
brotherDetail(
"Jean"
,
1, 10));


UC-02
Example of union of simpleType :

?
Generated WSDL+XSD for Use Case 1

?
Generated part of XSD for Use Case 2

?

9. Class Skeletons

?
可以将这个
DefaultComplexType类覆盖zend的library,不过这样貌似太粗暴,我是重新定义类名,放到个人类库里了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐