Getting faultstring: Procedure not present

Help
ZeWaren
2009-03-15
2013-06-06
  • ZeWaren

    ZeWaren - 2009-03-15

    Hello,
    I had a nice soap-server/soap-client relationship which is working perfectly. Everything is implemented under php5 using php-soap.

    Now I must convert the client to nusoap, since the application must run under soap free php installations (including php4).
    My problem is that each time I try to call a function, I get this fault:

        [faultcode] => SOAP-ENV:Server
        [faultstring] => Procedure 'truc' not present

    The server works perfectly with the php5 client, and its wsdl caching is disabled.

    Does anyone know how to fix this?

     
    • Karl3i

      Karl3i - 2009-03-16

      Hi,

      perhaps you can show us the piece of code that consumes the webservice?

      Regards.

       
    • ZeWaren

      ZeWaren - 2009-03-19

      I made a simpler one with the same problem:

      SOAP SERVER:

      <?php
      function procedure_magique($input) {
          return array("saucisse" => "sdfsdf");
      }

      ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
      ini_set("soap.wsdl_cache_ttl","0");
      $server = new SoapServer("soaptest.wsdl");
      $server->addFunction("procedure_magique");
      $server->handle();
      ?>

      PHP SOAP CLIENT (WORKING):
      <?php
      $client = new SoapClient("http://somewhere/some_path/soaptest/soap_server.php?wsdl");
      $result = $client->procedure_magique(array("in" => "some_text"));
      highlight_string(print_r($result, true));
      ?>
      Result:
      stdClass Object
      (
          [saucisse] => sdfsdf
      )

      NUSOAP CLIENT (NON WORKING):
      <?php
      $client = new soapclientNusoap('http://somewhere/some_path/soaptest/soap_server.php?wsdl', true);
      $result = $client->call('procedure_magique', array('in' => 'some_text'));
      highlight_string(print_r($result, true));
      ?>

      Result:
      Array
      (
          [faultcode] => SOAP-ENV:Server
          [faultstring] => Procedure 'procedure_magique' not present
      )

      WSDL:

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://some_website/some_path/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="soaptest" targetNamespace="http://some_website/some_path/">
      <wsdl:types>
      <xsd:schema targetNamespace="http://some_website/some_path/">
      <xsd:element name="procedure_magique">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="in" type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="procedure_magiqueResponse">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="saucisse" type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:schema>
      </wsdl:types>
      <wsdl:message name="procedure_magiqueRequest">
      <wsdl:part element="tns:procedure_magique" name="parameters"/>
      </wsdl:message>
      <wsdl:message name="procedure_magiqueResponse">
      <wsdl:part element="tns:procedure_magiqueResponse" name="parameters"/>
      </wsdl:message>
      <wsdl:portType name="soaptest">
      <wsdl:operation name="procedure_magique">
      <wsdl:input message="tns:procedure_magiqueRequest"/>
      <wsdl:output message="tns:procedure_magiqueResponse"/>
      </wsdl:operation>
      </wsdl:portType>
          <wsdl:binding name="soaptestSOAP" type="tns:soaptest">
              <soap:binding style="document"
                  transport="http://schemas.xmlsoap.org/soap/http" />
              <wsdl:operation name="procedure_magique">
                  <soap:operation
                      soapAction="http://some_website/some_path/procedure_magique" />
                  <wsdl:input>
                      <soap:body use="literal" />
                  </wsdl:input>
                  <wsdl:output>
                      <soap:body use="literal" />
                  </wsdl:output>
              </wsdl:operation>
          </wsdl:binding>
          <wsdl:service name="soaptest">
      <wsdl:port binding="tns:soaptestSOAP" name="soaptestSOAP">
      <soap:address location="http://somewhere/some_path/soaptest/soap_server.php"/>
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      I must precise that this wsdl file was generated using the eclipse wsdl extension.

      Do you see anything suspicious in this file?

       
    • Karl3i

      Karl3i - 2009-03-19

      Hi guy,

      The following code works for me using your server:

      ********************************* CODE
      <?php

      $path = "C:/nusoap-14032008";
      set_include_path(get_include_path() . PATH_SEPARATOR . $path);
      require_once("$path/lib/nusoap.php");

      $endpoint = "http://localhost/test/server.php";
      $client = new nusoap_client($endpoint,false);

      $methodname = "procedure_magique";
      $params = array('in' => 'some_text');
      $result = $client->call($methodname, $params, "http://some_website/some_path/");

      if ($client->fault) {
        print_r($result);
        echo "$result $client->request";
      }
      else {
        $err = $client->getError();
        if ($err) {
          echo "$err $client->request $client->response";
        }
        else {
          echo "Result: $result <BR>\n HTTP Response " . htmlspecialchars($client->response,ENT_QUOTES) . " <BR>\n HTTP request " . htmlspecialchars($client->request,ENT_QUOTES) ;
        }
      }
      ?>
      ********************************* CODE

      I think the main difference between our code snippets is that you are not mentionning the namespace when calling your webmethod (http://some_website/some_path/).

      Regards,

      Karl.

       
    • ZeWaren

      ZeWaren - 2009-03-21

      Well, your code worked for me.
      I had try to call the method including the namespace, but it didn't work.
      What changed my code is the fact that I created the client in wsdl mode, and you created it in endpoint mode.

      I still don't know why the wsdl mode doesn't work, but since my code now works in endpoint mode, I can continue my work.

      Thank you.

      Erwan.

       
      • Karl3i

        Karl3i - 2009-03-21

        May be you will want to compare the request (HTTP header + body) that is sent in the endpoint mode with the one sent in the wsdl mode. That may give you the answer?

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks