Issues

ZF-5604: Invalid complex type handling in strategy ArrayOfTypeComplex

Issue Type: Sub-task Created: 2009-01-21T19:32:30.000+0000 Last Updated: 2009-02-11T17:12:14.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Tomasz Gunerski (tommygun) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Soap_Wsdl

Related issues: - ZF-5754

Attachments:

Description

This is similar issue like this http://framework.zend.com/issues/browse/ZF-5430 but with ArrayOfTypeComplex strategy.

This files:

<pre class="highlight">
require_once 'Zend/Loader.php';
require_once './My_Service.class.php';
Zend_Loader::registerAutoload();
$autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$autodiscover->setClass('My_Service');
$autodiscover->handle();



<pre class="highlight">
<?php
class My_Service
{
    /**
    *   @param string $foo   
    *   @return My_Response[]
    */
    public function foo($foo)
    {       
       // code  
    }
    
    /**
    *   @param string $bar
    *   @return My_Response[]
    */
    public function bar($bar)
    {       
       // code  
    }
    
    /**
    *   @param string $baz
    *   @return My_Response[]
    */
    public function baz($baz)
    {       
       // code  
    }
}

class My_Response
{
    /**
    *   @var string
    */
    public $p1;
}

generates this invalid wsdl:


www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="My_Service" targetNamespace="http://example.com/service.php">

`` and it should generate wsdl like this:

<pre class="highlight">
<?xml version="1.0"?>
www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="My_Service" targetNamespace="http://example.com/service.php">
    
            
            
            
            
            
            
            
            

`` h3.Summary: Type of response message should be "ArrayOfMy_Response" not "My_Response[]"

Valid:

<pre class="highlight">

Invalid:

<pre class="highlight">

Solution proposed by Christian M√ľnch in http://framework.zend.com/issues/browse/ZF-5430

<pre class="highlight">
91: $this->getContext()->addType($type);

changed to:

<pre class="highlight">
91: $this->getContext()->addType($complexTypeName);

solves this issue but duplicates complex type definition in wsdl file. For example:

<pre class="highlight">

My temporary solution:

<pre class="highlight">
472:    public function toXML()
473:    {
474:        return preg_replace('/(?<=\s)type\=\"tns\:([a-zA-Z_]+)\[\]/', 'type="tns:ArrayOf\1', $this->_dom->saveXML());
475:           // return $this->_dom->saveXML();
476:    }

Comments

Posted by Benjamin Eberlei (beberlei) on 2009-01-22T12:54:38.000+0000

Fixed in trunk, will be in next minor version 1.8 - Can you please test the functionality?

Posted by Tomasz Gunerski (tommygun) on 2009-01-23T12:51:12.000+0000

Works fine now, thanks.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts