Zend Framework

Namespaces and WSDL Autodiscovery - PHP 5.3

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.4
  • Fix Version/s: None
  • Component/s: Zend_Soap_Wsdl
  • Labels:
    None

Description

In the new relase of PHP (5.3) namespaces was introduced.
When using these in conjuction with the AutoDiscover there are some problemes.

Consider this example.

/**
* @param some\package\Product
* @return boolean
*/
function foo($obj) {
 // implementation
 returns true;
}

When the autodiscover generates the WSDL, the complex definition of Object is namespaced in the wsdl complex name and in the message part type definition, example.

<xsd:complexType name="some\package\Product">
<xsd:all>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="productNo" type="xsd:string"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="description" type="xsd:string"/>
<xsd:element name="extendedDescription" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="vat" type="xsd:float"/>
<xsd:element name="currency" type="xsd:string"/>
<xsd:element name="productGroup" type="xsd:int"/>
</xsd:all>
</xsd:complexType>

<message name="addProductRequest">
<part name="product" type="tns:some\package\Product"/>
</message>

This looks ok, but when trying to connect this to SoapUi ie. this failes because of the slashes in the namespace.

I found a workaround for this, by rewriting the type which is send down to DefaultComplexType.php. That way the namespace is seperated by . (dott) in the wsdl, but it uses the correct namespace when reflects the object, creating the complex type.

We will probably end up extending the wsdl strategy classes, implementing this solution, but it would be nice if this could be fixed in an upcomming release of the Zend framework.

Activity

Hide
Benjamin Eberlei added a comment -

very good point

Show
Benjamin Eberlei added a comment - very good point
Hide
Sasa Stamenkovic added a comment -

Can you share the workaround please?

Show
Sasa Stamenkovic added a comment - Can you share the workaround please?

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated: