SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Lorna book in adv php - in 3rd api ch. - includes a wsdl.xml file and client, but se

    I am a reader of Lorna book in adv php - in 3rd api ch. - includes a wsdl.xml file and client, but seems function in wsdl no return anything, but in reality return (prior example return string --- but now wsdl no return) can you provide wsdl that returns or tell how run function - just the example in wsdl show extract functions like: /// i tried but can not generate a wsdl

    $functions = $client->__getFunctions();
    var_dump($functions);

    // getting >>>
    array(2) { [0]=> string(35) "void countWords(anyType $paragraph)" [1]=> string(60) "void getDisplayName(anyType $first_name, anyType $last_name)" }

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I'm guessing you mean
    "PHP Master: Write Cutting-edge Code" ??

  3. #3
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    yes correct....

    in wsdl script valid for function that returns value?

  4. #4
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    well, is it wsdl that return the functions value?

    also if localhost(xampp) not support
    curl_init
    what do to activate?

    in WSs last section of Rest code to run the Rest web service like p.118:

    Code:
      $ch = curl_init('http://localhost/rest/events');
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $response = curl_exec($ch);
      $events = json_decode($response,1);
    i must have the folder of ch.3: /rest/ to root of localhost? or the contents of /rest/ directly to the root? or on live server to it domain root?
    so with above i must echo the $events? and this snipet above can be in other domain than the rest web service?

  5. #5
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    index.php is called implicitly in REST ws?

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Sorry, I'm having trouble understandng.

    The wsdl file is like "instructions" or "rules", it isn't meant to "return something". It's an XML file used for data integrity
    Code XML:
    <?xml version='1.0' encoding='UTF-8'?>
    <definitions name="SimpleWSDL" targetNamespace="urn:SimpleWSDL"
    xmlns:typens="urn:SimpleWSDL" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns="http://schemas.xmlsoap.org/wsdl/">
    	<message name="countWords">
    		<part name="paragraph" type="xsd:anyType"></part>
    	</message>
    	<message name="countWordsResponse"></message>
    	<message name="getDisplayName">
    		<part name="first_name" type="xsd:anyType"></part>
    		<part name="last_name" type="xsd:anyType"></part>
    	</message>
    	<message name="getDisplayNameResponse"></message>
    	<portType name="ServiceFunctionsPortType">
    		<operation name="countWords">
    			<input message="typens:countWords"></input>
    			<output message="typens:countWordsResponse"></output>
    		</operation>
    		<operation name="getDisplayName">
    			<input message="typens:getDisplayName"></input>
    				<output message="typens:getDisplayNameResponse"></output>
    		</operation>
    	</portType>
    	<binding name="ServiceFunctionsBinding"	type="typens:ServiceFunctionsPortType">
    		<soap:binding style="rpc"	transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
    		<operation name="countWords">
    			<soap:operation soapAction="urn:ServiceFunctionsAction"></soap:operation>
    			<input>
    				<soap:body namespace="urn:SimpleWSDL" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    				</soap:body>
    			</input>
    			<output>
    				<soap:body namespace="urn:SimpleWSDL" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    				</soap:body>
    			</output>
    		</operation>
    		<operation name="getDisplayName">
    			<soap:operation soapAction="urn:ServiceFunctionsAction"> </soap:operation>
    			<input>
    				<soap:body namespace="urn:SimpleWSDL" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    				</soap:body>
    			</input>
    			<output>
    				<soap:body namespace="urn:SimpleWSDL" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    				</soap:body>
    			</output>
    		</operation>
    	</binding>
    	<service name="SimpleWSDLService">
    		<port name="ServiceFunctionsPort" binding="typens:ServiceFunctionsBinding">
    			<soap:address location="http://localhost/soap-server.php">
    			</soap:address>
    		</port>
    	</service>
    </definitions>

    If you are having trouble with PHP, check your php.ini file, it should have a secion like
    Code:
    [soap]
    ; Enables or disables WSDL caching feature.
    ; http://php.net/soap.wsdl-cache-enabled
    soap.wsdl_cache_enabled=1
    
    ; Sets the directory name where SOAP extension will put cache files.
    ; http://php.net/soap.wsdl-cache-dir
    ;soap.wsdl_cache_dir="/tmp"
    soap.wsdl_cache_dir="C:/PHP/tmp"
    
    ; (time to live) Sets the number of second while cached file will be used
    ; instead of original one.
    ; http://php.net/soap.wsdl-cache-ttl
    soap.wsdl_cache_ttl=86400
    
    ; Sets the size of the cache limit. (Max. number of WSDL files to cache)
    soap.wsdl_cache_limit = 5

  7. #7
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    wsdl
    This wsdl is the same as in the book? and came from class that its both methods return value?

    In php.ini for wsdl to work must match above as you put in this thread from php.ini?

    rest
    i must have the folder of ch.3: /rest/ to root of localhost? or the contents of /rest/ directly to the root? or on live server to it domain root?
    so with below code i must echo the $events? and this snippet above can be in other domain than the rest web service?
    in WSs last section of Rest code to run the Rest web service like p.118:

    Code:
      $ch = curl_init('http://localhost/rest/events');    // http://localhost/rest/events  OR http://localhost/events
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $response = curl_exec($ch);
      $events = json_decode($response,1);
    index.php is called implicitly in REST ws?

  8. #8
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    It's been a while since I've worked with SOAP or REST and haved preferred JSON for a while.
    I don't have the book you're working through, so that complicates things too.

    In any case, I'm digging through my old files looking for my last working code for you to try. Hopefully I'll find something helpful soon.

    In the meantime, please read these as I think they should answer some of your questions.
    http://www.sitepoint.com/web-service...hp-and-soap-1/
    http://www.sitepoint.com/web-service...hp-and-soap-2/

    I also forgot to mention that you will need to make sure your php.ini file has the soap dll line uncommented
    Code:
    extension=php_soap.dll

  9. #9
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Finally found some old example files.

    First thing you should do is, if you don't already, put this in your server's root and go to it in your browser
    Code PHP:
    <?php
    phpinfo();
    ?>
    you should see something in it like
    soap.png
    Then in a soap folder put
    catalog.wsdl
    Code XML:
    <?xml version ='1.0' encoding ='UTF-8' ?> 
    <definitions name='Catalog' 
      targetNamespace='http://example.org/catalog' 
      xmlns:tns='http://example.org/catalog' 
      xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
      xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
      xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
      xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
      xmlns='http://schemas.xmlsoap.org/wsdl/'> 
     
    <message name='getCatalogRequest'> 
      <part name='catalogId' type='xsd:string'/> 
    </message> 
    <message name='getCatalogResponse'> 
      <part name='Result' type='xsd:string'/> 
    </message> 
     
    <portType name='CatalogPortType'> 
      <operation name='getCatalogEntry'> 
        <input message='tns:getCatalogRequest'/> 
        <output message='tns:getCatalogResponse'/> 
      </operation> 
    </portType> 
     
    <binding name='CatalogBinding' type='tns:CatalogPortType'> 
      <soap:binding style='rpc' 
        transport='http://schemas.xmlsoap.org/soap/http'/> 
      <operation name='getCatalogEntry'> 
        <soap:operation soapAction='urn:localhost-catalog#getCatalogEntry'/> 
        <input> 
          <soap:body use='encoded' namespace='urn:localhost-catalog' 
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </input> 
        <output> 
          <soap:body use='encoded' namespace='urn:localhost-catalog' 
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </output> 
      </operation> 
    </binding> 
     
    <service name='CatalogService'> 
      <port name='CatalogPort' binding='CatalogBinding'> 
        <soap:address location='http://localhost/soap/soap-server.php'/> 
      </port> 
    </service>
    </definitions>
    soap-server.php
    Code PHP:
    <?php
    function getCatalogEntry($catalogId)
    { 
    	if ($catalogId == 'catalog1')
    	{
    	$first = "<html><head><title>Catalog</title></head>
    	<body>
    	<table>
    	<tr>
    	<th>CatalogId</th>
    	<th>Journal</th>
    	<th>Section</th>
    	<th>Edition</th>
    	<th>Title</th>
    	<th>Author</th>
    	</tr>
    	<tr>
    	<td>catalog1</td>
    	<td>IBM developerWorks</td>
    	<td>XML</td>
    	<td>October 2005</td>
    	<td>JAXP validation</td>
    	<td>Brett McLaughlin</td>
    	</tr>
    	</table>
    	</body>
    	</html>";
    	return $first;
    	}
    	elseif ($catalogId == 'catalog2')
    	{
    	$second = "<html><head><title>Catalog</title></head>
    	<body>
    	<table>
    	<tr>
    	<th>CatalogId</th>
    	<th>Journal</th>
    	<th>Section</th>
    	<th>Edition</th>
    	<th>Title</th>
    	<th>Author</th>
    	</tr>
    	<tr>
    	<td>catalog2</td>
    	<td>IBM developerWorks</td>
    	<td>XML</td>
    	<td>July 2006</td>
    	<td>The Java XPath API</td>
    	<td>Elliotte Harold</td>
    	</tr>
    	</table>
    	</body>
    	</html>";
    	return $second;
    	}
    }
    ini_set("soap.wsdl_cache_enabled", false); 
    $server = new SoapServer("http://localhost/soap/catalog.wsdl");
    $server->addFunction("getCatalogEntry"); 
    $server->handle(); 
     
    ?>
    and
    soap-client.php
    Code PHP:
    <?php
    try
    {
      $client = new SoapClient("http://localhost/soap/catalog.wsdl");
      $catalogId = 'catalog1';
      $response = $client->getCatalogEntry($catalogId);
    }
    catch (SoapFault $fault)
    {
        trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
    }
      var_dump($response);
    ?>
    If all is well, when you go to http://localhost/soap/soap-client.php you should see
    soap-client.png

  10. #10
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    your example succed thks but mine still getting not the result

    your example succed thks but mine still getting not the result - i get:
    array(2) { [0]=> string(35) "void countWords(anyType $paragraph)" [1]=> string(60) "void getDisplayName(anyType $first_name, anyType $last_name)" }

    soap-client-live-wsdl-xml.php
    Code:
    <?php
    
    ini_set('soap.wsdl_cache_enabled', 0);
    $client = new SoapClient('http://localhost/VT/Learnable/OOP-PHP/spbooks-PHPPRO1-ae9bb56/spbooks-PHPPRO1-ae9bb56/chapter_03/wsdl.wsdl');
    $functions = $client->__getFunctions();
    var_dump($functions);
    echo "<hr/>";
    echo $client->getDisplayName('Joe', 'Bloggs');

    wsdl.wsdl
    HTML Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <definitions name="SimpleWSDL" targetNamespace="urn:SimpleWSDL" 
    xmlns:typens="urn:SimpleWSDL" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns="http://schemas.xmlsoap.org/wsdl/">
      <message name="countWords"><part name="paragraph" 
    type="xsd:anyType"></part></message>
      <message name="countWordsResponse"></message>
      <message name="getDisplayName"><part name="first_name" 
    type="xsd:anyType"></part><part name="last_name" 
    type="xsd:anyType"></part></message>
      <message name="getDisplayNameResponse"></message>
      <portType name="ServiceFunctionsPortType">
        <operation name="countWords"><input 
    message="typens:countWords"></input><output 
    message="typens:countWordsResponse"></output></operation>
        <operation name="getDisplayName"><input 
    message="typens:getDisplayName"></input><output 
    message="typens:getDisplayNameResponse"></output></operation>
      </portType>
      <binding name="ServiceFunctionsBinding" 
    type="typens:ServiceFunctionsPortType"><soap:binding style="rpc" 
    transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
        <operation name="countWords">
          <soap:operation soapAction="urn:ServiceFunctionsAction"></soap:operation>
          <input><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></input>
          <output><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></output>
        </operation>
        <operation name="getDisplayName">
          <soap:operation soapAction="urn:ServiceFunctionsAction"></soap:operation>
          <input><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></input>
          <output><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></output>
        </operation>
      </binding>
      <service name="SimpleWSDLService">
        <port name="ServiceFunctionsPort" 
    binding="typens:ServiceFunctionsBinding"><soap:address location="http://localhost/VT/Learnable/OOP-PHP/spbooks-PHPPRO1-ae9bb56/spbooks-PHPPRO1-ae9bb56/chapter_03/soap-server-WSDL.php"></soap:address></port>
      </service>
    </definitions>
    soap-server-WSDL.php
    Code:
    <?php
    include 'ServiceFunctions.php';
    $options = array('uri' => 'http://localhost/');
    ini_set("soap.wsdl_cache_enabled", false); 
    $server = new SoapServer("http://localhost/VT/Learnable/OOP-PHP/spbooks-PHPPRO1-ae9bb56/spbooks-PHPPRO1-ae9bb56/chapter_03/wsdl.wsdl");
     
    $server->setClass('ServiceFunctions');
    $server->handle();
    ServiceFunctions.php
    Code:
    <?php
    class ServiceFunctions 
    {
      public static function getDisplayName($first_name, $last_name) {
        $name = '';
        $name .= strtoupper(substr($first_name, 0, 1));
        $name .= ' ' . strtoupper($last_name) . ' ' . ucfirst($last_name). " static" ;//strtoupper
        return $name;
      }
    
      public static function countWords($paragraph) {
        $words = preg_split('/[. ,!?;]+/',$paragraph);
        return count($words);
      }
    }
    ?>

  11. #11
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    see above... example using class not function like your example...

  12. #12
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    It took me a while to figure it out, but I got it working for me.

    First, do you really have this folder structure?
    http://localhost/VT/Learnable/OOP-PHP/spbooks-PHPPRO1-ae9bb56/spbooks-PHPPRO1-ae9bb56/chapter_03/soap-server-WSDL.php

    I wasn't about to replicate that and simply put the 4 files in
    http://localhost/soap/

    The problem is with the WSDL file. It doesn't specify "type" for the "Response" returns, so nothing gets returned.
    Try changing this section by adding the "parts"
    Code XML:
    .....
      <message name="countWords">
    <!--
    	<part name="paragraph" type="xsd:anyType"></part>
    -->
    	<part name="paragraph" type="xsd:string"></part>
      </message>
      <message name="countWordsResponse">
      <part name='Result' type='xsd:int'/> </message>
      <message name="getDisplayName">
    <!--
        <part name="first_name" type="xsd:anyType"></part>
    	<part name="last_name" type="xsd:anyType"></part>
    -->
    	<part name="first_name" type="xsd:string"></part>
    	<part name="last_name" type="xsd:string"></part>
      </message>
      <message name="getDisplayNameResponse">
      <part name='Result' type='xsd:string'/> </message>
    .....

  13. #13
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    "...can you provide wsdl that returns ..."
    I say this in first post... well this you say is to declare string for input... isn't output that counts?
    http://localhost/VT/Learnable/OOP-PH...e-wsdl-xml.php

    prior
    array(2) { [0]=> string(35) "void countWords(anyType $paragraph)" [1]=> string(60) "void getDisplayName(anyType $first_name, anyType $last_name)" }
    after
    array(2) { [0]=> string(34) "void countWords(string $paragraph)" [1]=> string(58) "void getDisplayName(string $first_name, string $last_name)" }

    does not proceed....well?

  14. #14
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Your __getFunctions() is still showing "void"
    Did you only change the "input" "parts" and not add the new "response" "parts"?

  15. #15
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    wsdl syntax - i do not know well... i tried used code example came with sitepoint/learnable book of Lorna... can you tell if code example is correct as of wsdl file?
    the exact file is this - is it for functions give output or only void??? can you correct ?
    HTML Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <definitions name="SimpleWSDL" targetNamespace="urn:SimpleWSDL" 
    xmlns:typens="urn:SimpleWSDL" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns="http://schemas.xmlsoap.org/wsdl/">
      <message name="countWords"><part name="paragraph" 
    type="xsd:anyType"></part></message>
      <message name="countWordsResponse"></message>
      <message name="getDisplayName"><part name="first_name" 
    type="xsd:anyType"></part><part name="last_name" 
    type="xsd:anyType"></part></message>
      <message name="getDisplayNameResponse"></message>
      <portType name="ServiceFunctionsPortType">
        <operation name="countWords"><input 
    message="typens:countWords"></input><output 
    message="typens:countWordsResponse"></output></operation>
        <operation name="getDisplayName"><input 
    message="typens:getDisplayName"></input><output 
    message="typens:getDisplayNameResponse"></output></operation>
      </portType>
      <binding name="ServiceFunctionsBinding" 
    type="typens:ServiceFunctionsPortType"><soap:binding style="rpc" 
    transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
        <operation name="countWords">
          <soap:operation soapAction="urn:ServiceFunctionsAction"></soap:operation>
          <input><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></input>
          <output><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></output>
        </operation>
        <operation name="getDisplayName">
          <soap:operation soapAction="urn:ServiceFunctionsAction"></soap:operation>
          <input><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></input>
          <output><soap:body namespace="urn:SimpleWSDL" use="encoded" 
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></output>
        </operation>
      </binding>
      <service name="SimpleWSDLService">
        <port name="ServiceFunctionsPort" 
    binding="typens:ServiceFunctionsBinding"><soap:address location="http://localhost/soap-
    server.php"></soap:address></port>
      </service>
    </definitions>

  16. #16
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    can you fix wsdl so as (for functions that) return values? where are "response" "parts"? you know andy site you put functions or class/methods and get wsdl?

  17. #17
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I added output
    Code:
      <message name="countWords"><part name="paragraph" 
    type="xsd:string"></part></message>
      <message name="countWordsResponse"><part name="words" type="xsd:integer"></part></message>
      <message name="getDisplayName"><part name="first_name" 
    type="xsd:string"></part><part name="last_name" 
    type="xsd:string"></part></message>
      <message name="getDisplayNameResponse"><part name="name" type="xsd:string"></part></message>
    now getting
    array(2) { [0]=> string(37) "integer countWords(string $paragraph)" [1]=> string(60) "string getDisplayName(string $first_name, string $last_name)" }

    but
    this never runs: // white space rather the result.... well?
    echo $client->getDisplayName('Joe', 'Bloggs');

  18. #18
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    well is it correct the wsdl or can you fix wsdl so as (for functions that) return values?

  19. #19
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,259
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Sorry to be gone so long.

    You put "integer" instead of int

    With this for the "client" (*note location and name differences for me, don't just copy/paste)
    PHP Code:
    <?php
    try
    {
    ini_set('soap.wsdl_cache_enabled'0);
    $client = new SoapClient('http://localhost/soap/lse123.wsdl');
    var_dump($client->__getFunctions());
    echo 
    "<hr/>";
    echo 
    $client->getDisplayName('Joe''Bloggs');
    echo 
    "<hr/>";
    echo 
    $client->countWords('Joe Bloggs was here having a great time');
    echo 
    "<hr/>";
    }
    catch (
    SoapFault $fault)
    {
        echo 
    "SOAP Fault: faultcode: " $fault->faultcode " faultstring: " $fault->faultstring;
    }
    ?>
    I see
    lse123-soap.png

  20. #20
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I retried with "int" but same thing. no work functions...

    I get only

    Code:
    array(2) { [0]=> string(33) "int countWords(string $paragraph)" [1]=> string(60) "string getDisplayName(string $first_name, string $last_name)" }
    and 3 <hr/> without anything between without exception texts...

  21. #21
    SitePoint Addict
    Join Date
    May 2013
    Posts
    204
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    worked thks a lot...

    additionally there was a typo i had both wsdl.xml wdsl.wsdl and client used one server the other


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •