Menu

character encoding in wsdl and namespace argu

Help
2009-03-16
2013-06-06
  • Kostas Kalevras

    Kostas Kalevras - 2009-03-16

    I didn't get a response in my email to nusoap-general@lists.sourceforge.net so i am posting here as well:

    I would like to report one bug and make a small feature request.

    feature request:
    It would be of great help if there was a way (ie a variable in nusoap.php) for the administrator to set the character encoding of the generated WSDL (The <?xml version="1.0" encoding="ISO-8859-1"?> part). In my case i had the web service functions documentation written in greek and i had to change the encoding to ISO-8859-7 by hand for the auto-generated WSDL.

    bug:
    The register() function prototype is the following:
    * @param string $name the name of the PHP function, class.method or class..method
    * @param array $in assoc array of input values: key = param name, value = param type
    * @param array $out assoc array of output values: key = param name, value = param type
    * @param mixed $namespace the element namespace for the method or false

    with: function register($name,$in=array(),$out=array(),$namespace=false
    (i am ommiting the parts that are not necessary for the discussion).

    If i provide a namespace argument for a function i get the following fault on the client (while parsing the WSDL):
    [WARNING] R2716 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit for soapbind:body: "SearchUser"
    line 370 of file:/C:/temp/NetBeansProjects/testWSDL3/xml-resources/web-service-references/reader/wsdl/<hostname>/ws/reader.php.wsdl

    According to the error, the <binding/> part of the wsdl should not include a namespace attribute:

    <binding name="ReaderInterfaceBinding" type="tns:ReaderInterfacePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

    <operation name="SearchUser">
    <soap:operation soapAction="http://<hostname>/ws/reader.php#SearchUser" style="document"/>

    <input>
    <soap:body use="literal" namespace="http://<hostname>/ws/reader.php"/>
    </input>

    <output>
    <soap:body use="literal" namespace="http://<hostname>/ws/reader.php"/>
    </output>
    </operation>

    If i try to set the $namespace parameter to false i get an *empty* namespace attribute instead of the namespace attribute being ommited (and thus still hit the same error in wsdl parsing):

    <operation name="SearchUser">
    <soap:operation soapAction="http://<hostname>/ws/reader.php#SearchUser" style="document"/>

    <input>
    <soap:body use="literal" namespace=""/>
    </input>

    <output>
    <soap:body use="literal" namespace=""/>
    </output>
    </operation>

    I have to save and manually edit the WSDL file (to remove the namespace="" parts) in order for it to be parsed correctly. I think that it would be best not to include the namespace attribute if it is passed as a false (null) value in the register() function.

    Thank you all for your time.

    --
    Kostas Kalevras - Network Operations Center
    National Technical University of Athens
    http://kkalev.wordpress.com

     
    • Kostas Kalevras

      Kostas Kalevras - 2009-03-31

      anyone?

       
    • Kostas Kalevras

      Kostas Kalevras - 2009-09-03

      Since i didn't get any responses here's the patch for the namespace bug. Hope it makes it in a newer version:

      --- nusoap.php  2007-11-06 18:00:36.000000000 +0200
      +++ /var/www/html/ws/lib/nusoap.php     2009-08-28 12:56:26.000000000 +0300
      @@ -5443,13 +5443,19 @@
                                              } else {
                                                      $enc_style = '';
                                              }
      -                                       $binding_xml .= "\n" . '    <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
      +                                       $binding_xml .= "\n" . '    <input><soap:body use="' . $opParts['input']['use'];
      +                                       if ($opParts['input']['namespace'] != '')
      +                                               $binding_xml .= '" namespace="' . $opParts['input']['namespace'];
      +                                       $binding_xml .= '"' . $enc_style . '/></input>';
                                              if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
                                                      $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
                                              } else {
                                                      $enc_style = '';
                                              }
      -                                       $binding_xml .= "\n" . '    <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
      +                                       $binding_xml .= "\n" . '    <output><soap:body use="' . $opParts['output']['use'];
      +                                       if ($opParts['output']['namespace'] != '')
      +                                               $binding_xml .= '" namespace="' . $opParts['output']['namespace'];
      +                                       $binding_xml .= '"' . $enc_style . '/></output>';
                                              $binding_xml .= "\n" . '  </operation>';
                                              $portType_xml .= "\n" . '  <operation name="' . $opParts['name'] . '"';
                                              if (isset($opParts['parameterOrder'])) {

       

Log in to post a comment.