ZF-6049: Bug with 'literal' style not being importable from WSImport


The following issue came up on the mailing list:


I have been trying to generate a java client to a soap service that is built with zf. The wsdl file is generated with Zend_Soap_AutoDiscover but I am not able to create the java client. Attached is the a dummy service and the code that creates the wsdl file. Im trying to create my java client using wsimport from jaxws.….

Any other suggestions and or experiences on how to best create a java client for a zf soap service is welcome.

This is the error I get.

sh http://localhost/soap/?wsdl [ERROR] Invalid wsdl:operation "method1": its a document-literal operation,  message part must refer to a schema element declaration   line 2 of http://localhost/soap/?wsdl

I tried to patch the Zend_Soap_Wsdl to use literal according to this thread… but then of course I have to provide a schema for my operations. My patch is pretty stupid but available here if anyone interested,

When that patch applied I get the following error instead. Which seems to indicate that the wsdl file is correct if I am not mistaken.

$ sh http://localhost/soap/?wsdl [ERROR] Schema descriptor {http://localhost/soap/}method1Request in message part "inputParam" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://localhost/soap/}method1Request is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch.   line 2 of http://localhost/soap/?wsdl

My test code, also available here if it is broken below.

require_once "Zend/Loader.php";

class MyClass {
     * This method takes ...
     * @param integer $inputParam
     * @return string
    public function method1($inputParam) {
        return rand(1,10);

if(isset($_GET['wsdl'])) {
    $autodiscover = new Zend_Soap_AutoDiscover();
                    array('style' => 'document',
                          'transport' => '')
                  array('use' => 'literal')

} else if (isset($_GET['client'])) {
    $client = new Zend_Soap_Client("http://localhost/soap/?wsdl");
    echo $client->method1(10);
} else {
    $soap = new Zend_Soap_Server("http://localhost/soap/?wsdl");


This is a duplicate.