Zend WSDL Autodiscover from docblock

For programming and general questions on Zend Framework

Zend WSDL Autodiscover from docblock

Postby oxomichael on Fri Aug 06, 2010 1:14 pm

Hello,

I'm made a soap server in Document/Literal and i let the zend framework generate my wsdl with the Zend_Soap_AutoDiscover and my docblock. All seem good.
I'm looking to generate also

  • documentation for each element as
    Code: Select all
    <xsd:annotation><xsd:documentation>.....</xsd:documentation></xsd:annotation>
  • restriction
  • enumeration

I don't see anything in the programmer's reference.

What i can do ?
Is somebody has some example or could describe method to make it ?
oxomichael
 
Posts: 3
Joined: Fri Aug 06, 2010 1:05 pm

Re: Zend WSDL Autodiscover from docblock

Postby jboffel on Fri Nov 12, 2010 3:55 pm

If you are using the default strategy based on defaultComplexType, it is not possible currently with what is available directly in the code of the Framework, but you could try to use my work. My version of defaultComplexType that can handle restriction and enumeration. Not yet documentation though. Could be an idea of improvement for my own class either.

You just have to copy my class and change name to avoid conflict, then use the setComplexTypeStrategy function available with Zend_Soap_AutoDiscover to use my class. Then add needed class and docblock related to your restriction.

http://framework.zend.com/wiki/display/ZFPROP/Zend_Soap_Wsdl_Strategy_DefaultComplexType+-+Improvement+for+the+AutoDiscover+-+Jeannie+BOFFEL
jboffel
 
Posts: 9
Joined: Fri Nov 12, 2010 3:49 pm

Re: Zend WSDL Autodiscover from docblock

Postby oxomichael on Wed Nov 17, 2010 3:52 pm

Thanks for your answer and your great work.

I hope other features are in ZF in future.

For other who are searching functionnality such as

Compatibilty with document-literal wrapped, you could see
http://framework.zend.com/issues/browse/ZF-6351

Have documentation in WSDL
http://framework.zend.com/issues/browse/ZF-10274

But i really change (sorry for french in comment):

Code: Select all
Le fichier Zend/Soap/Wsdl/Strategy/DefaultComplexType.php a été modifié pour
générer la documentation automatiquement.

/**
* Traitement éléments de documentation à placer dans le WSDL
* Supprime les retours chariots.
* Récupére les éléments de documentation
*/
$comment = '';
$docBlock = preg_replace('/\n/', '', $property->getDocComment() );
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+\s+(?:\*|@)/m', $docBlock, $docBlockMatches)) {
   $comment.= preg_replace(
         array('/\r/', '/\t\s\*/'),
       array('', ''), $docBlockMatches[1]
    );
}

/**
* Ajout des éléments de documentation au WSDL
*/
if (!empty($comment)){
   $annotation = $dom->createElement('xsd:annotation');
   $documentation = $dom->createElement('xsd:documentation', trim($comment));
   $annotation->appendChild($documentation);
   $element->appendChild($annotation);
}

===============================================================================>

Le fichier Zend/Soap/AutoDiscover.php a été modifié
function _addFunctionToWsdl

$sequenceElement = array(
   'name' => $param->getName(),
   'type' => $wsdl->getType($param->getType()),
    'desc' => $param->getDescription()
);

===============================================================================>

Le fichier Zend/Soap/Wsdl.php a été modifié
function _parseElement

} elseif ($key == 'desc') {
   if (!empty($value)) {
       $annotation = $this->_dom->createElement('xsd:annotation');
        $documentation = $this->_dom->createElement('xsd:documentation', trim($value));
        $annotation->appendChild($documentation);
        $elementXml->appendChild($annotation);
   }
} else {
oxomichael
 
Posts: 3
Joined: Fri Aug 06, 2010 1:05 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 9 guests