Re: Failed to print "Hello user"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Rob Richards,

Thank you for your help. All files are in same directory including
hello.wsdl.
This is the path: (http://www.firmanettiin.fi/mydirectory/myfiles), but
still getting an error.

Please note: The file hello.wsdl was just taken from 
http://www.wso2.org/node/1060/ and put it in mydirectory without modifying
it, so do I need to do some changes on that file.

Also the file hello.wsdl can be read using file_get_contents('hello.wsdl'); 

All three files are pasted here in case you wanna see them:

//server.php

<?php

function greet($param)
{
	$retval = 'Hello '.$param->name;
	$result = array('greetReturn' => $retval);
	return $result;
	}
	$server = new SoapServer('hello.wsdl');
	$server->addFunction('greet');
	$server->handle();
?>
//*************End server.php**************

 //client.php

<?php
try
{
	$client = new SoapClient('hello.wsdl');
	$result =  $client->__soapCall('greet', array(array('name' => 'Abdi')));
	echo "Result = ". $result->greetReturn;
	//printf("Result = %s\n", $result->greetReturn);
	}
	catch (Exception $e)
	{
		echo "Error message = ".$e->__toString();
		//printf("Message = %s\n",$e->__toString());
	}

?>
//*************End client.php**************

//hello.wsdl

<wsdl:definitions 
    xmlns:impl='http://wso2.org/wsf/php/helloService' 
    xmlns:intf='http://wso2.org/wsf/php/helloService' 
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
    xmlns:wsdlsoap='http://schemas.xmlsoap.org/wsdl/soap/' 
    xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
    targetNamespace='http://wso2.org/wsf/php/helloService'>  
  <wsdl:types>
    <schema elementFormDefault='qualified' 
        xmlns:impl='http://wso2.org/wsf/php/helloService' 
        xmlns:intf='http://wso2.org/wsf/php/helloService' 
        xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
        xmlns="http://www.w3.org/2001/XMLSchema"; 
        targetNamespace='http://wso2.org/wsf/php/helloService' >
      <element name='greet'>
        <complexType>
          <sequence>
            <element name='name' type='xsd:string' />
          </sequence>
        </complexType>
      </element>
      <element name='greetResponse'>
        <complexType>
          <sequence>
            <element name='greetReturn' type='xsd:string' />
          </sequence>
        </complexType>
      </element>
    </schema>
  </wsdl:types>
  <wsdl:message name='greetRequest'>
    <wsdl:part name='parameters' element='impl:greet' />
  </wsdl:message>
  <wsdl:message name='greetResponse'>
    <wsdl:part name='parameters' element='impl:greetResponse' />
  </wsdl:message>
  <wsdl:portType name='helloService'>
    <wsdl:operation name='greet'>
      <wsdl:input name='greetRequest' message='impl:greetRequest' />
      <wsdl:output name='greetResponse' message='impl:greetResponse' />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name='helloServiceSoapBinding' type='impl:helloService'>
    <wsdlsoap:binding transport='http://schemas.xmlsoap.org/soap/http'
style='document' />
    <wsdl:operation name='greet'>
      <wsdlsoap:operation soapAction='helloService#greet' />
      <wsdl:input name='greetRequest'>
        <wsdlsoap:body use='literal' />
      </wsdl:input>
      <wsdl:output name='greetResponse'>
        <wsdlsoap:body use='literal' />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name='helloService'>
    <wsdl:port binding='impl:helloServiceSoapBinding' name='helloService'>
      <wsdlsoap:address
location='http://localhost/hello/hello_service_wsdl.php' />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

//*************************End hello.wsdl*********************************

//Error message

Error message = SoapFault exception: [Client] DTD are not supported by SOAP
in
/var/www/clients/www.firmanettiin.fi/docs/projektit/bsf_dummy/client.php:5
Stack trace: #0
/var/www/clients/www.firmanettiin.fi/docs/projektit/bsf_dummy/client.php(5):
SoapClient->__soapCall('greet', Array) #1 {main}

//***************End ******************************

Rob Richards wrote:
> 
> Abdi wrote:
>> Hello everybody, I am new php programmer.  I have no idea about Soap
>> server/client, but I need it for my project.
>> I just want to request to the server and get "Hello $username" as
>> respond.
>> Can any one help me please?
>> 
>> All these files are from http://www.wso2.org/node/1060/.
>> My hello.wsdl can be found above address. I don't know if need to modify
>> this file (hello.wsdl) or not. I copied and paste.
>> ........................................................................
> <snip />
> 
> First off, did you copy the wsdl locally:
>   does echo file_get_contents('hello.wsdl'); work?
> 
> Both the SoapClient and SoapServer take the path to the WSDL. This means 
> you can put it in the same dir as the server and have the server grab it 
> via 'hello.wsdl' and the client can grab it via 
> 'http://<serverpath>/hello.wsdl'
> 
> Hope that makes sense.
> 
> Rob
> 
> -- 
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Failed-to-print-%22Hello-user%22-tf3637536.html#a10175896
Sent from the Php - Soap mailing list archive at Nabble.com.

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux