Search code examples
phpsoapwsdlnusoap

Nusoap use existing WSDL how to?


so I have a WSDL I've been giving as documentation for a soap service. I need to implement this service exactly as defined and I don't want to rewrite the wsdl using nusoap. Is there a way to tell the object nusoap_server = new soap_server(); to use an existing wsdl and then implement the functions from the existing wsdl?

thanks


Solution

  • $WSDL = '/path/to/wsdl/file'; $nusoap_server = new soap_server($WSDL);

    The only problem with this is that nusoap may not create the response correctly, but it will host the wsdl file.

    I had to customize my xml responses.

    Which you can tell nusoap to do but you will need to modify the library.

    <?PHP     
    
    function serialize_return() {
                        //$this->fuze_debug(array('test',$this->fuze_print_s($this->methodreturn)),'soap_server_debug.log');
                        $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
                        // if fault
                        if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
                                $this->debug('got a fault object from method');
                                $this->fault = $this->methodreturn;
                                return;
                                // for some reason with code ignitor this doesnot get set correctly
                        } elseif ($this->methodreturnisliteralxml) {
                                //$this->fuze_debug(array('literal xml is : ',$this->fuze_print_s($this->methodreturnisliteralxml)),'soap_server_debug.log');
                                $return_val = $this->methodreturn;
                        // returned value(s)
                        } else {
    

    This above code is in the nusoap library as you can see $this->methodreturnisliteralxml

    If you set that to true then you can customize the xml you return from the function you define for nusoap to handle the soap request.

    To me nusoap seams to be out of date.

    I do not think I would use nusoap again for new projects.