1

i'm newbie in SoapServer and here is my found simple document and sample code about that. after generation SoapServer i get this Result :

<SOAP-ENV:Envelope>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>
            <faultstring>WSDL generation is not supported yet</faultstring>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is my simple WSDL source code:

Description: my file name in local host is: wsdl_sample1.php

<?php
class MyAPI {

    function hello() {
        return "Hello";
    }

}
$options=array('uri'=>'http://localhost/wsdl_sample1.php?wsdl');
$server = new SoapServer(NULL,$options);
$server->setClass('MyAPI');
$server->handle();
echo "SOAP Server started";
?>

how to change this code to resolve problem. Thanks.

1 Answer 1

1

The url (http://localhost/wsdl_sample1.php?wsdl) that you are providing should point to a valid WSDL file ( a tutorial on WSDL can be found here )

PHP natively does not support WSDL generation. Zend Framework's classes however, do: See Zend Framework's Zend_Soap_Autodiscover

Otherwise you are stuck with creating your own wsdl. You might get some use out of online WSDL generators like Online WSDL Generator to help you out a bit.

Goodluck!

7
  • Thanks sir. i want to use wsimport to generate functions for java for wsdl from SoapServer. my binding soap is RPC and after change that to document i get error both of chages. please help me to create or define correctly encoding for that. my simple template of SoapServer. paste.debian.net/115861
    – DolDurma
    Aug 16, 2014 at 8:09
  • 1
    I wish I could help you further, but after enduring the pains of SOAP for too long trying to get things to work in PHP, i forgot all about it and switched to a REST service. I can't help you with the quirks of SOAP itself. My knowledge ends at PHP's support of it. Aug 16, 2014 at 8:11
  • can you fix my wsdl xml template file? i can chage PHP code but problem is in xml of my link. problem is: [ERROR] "Use of SOAP Encoding is not supported. SOAP extension element on line 57 in http://localhost/wsdl1/index.php?wsdl has use="encoded" "
    – DolDurma
    Aug 16, 2014 at 8:14
  • 1
    Native ZendServer is rather limited. The Zend Framework soap classes are much better. Check out "framework.zend.com/manual/2.3/en/modules/zend.soap.server.html". You can get the neccesary files from the Zend Framework download (you dont need the entire framework, although you -do- need to included the required classes and their dependencies). Aug 16, 2014 at 8:17
  • 1
    Weird comment system. Here you go http://framework.zend.com/manual/2.3/en/modules/zend.soap.server.html Aug 16, 2014 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.