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. https://jax-ws.dev.java.net/jax-ws-ea3/docs/….

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 wsimport.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 http://nabble.com/Problems-generating-WebService-c… but then of course I have to provide a schema for my operations. My patch is pretty stupid but available here if anyone interested, http://gist.github.com/80610

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 wsimport.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. http://gist.github.com/80612

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' => 'http://schemas.xmlsoap.org/soap/http')
                  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.