Link to home
Start Free TrialLog in
Avatar of mwskuzzy
mwskuzzy

asked on

How can i get the wsdl xml string from pear soap server

I need to access a pear web service from Delphi but I cannot get the wsdl xml string for this web service. Does anybody know how to retrieve the wsdl string.

The php code client code is below. This is the php client code to access the web service but I need the wsdl to access it from Delphi if that is even possible.

<?php

// create SOAP object
$client = new SoapClient( null, array( 'location' => 'http://dev.gaumina.lt/examcraft_v1/ws/server.php?type=users',
                                       'uri'      => 'http://dev.gaumina.lt/examcraft_v1/ws/',
            'trace' => 1 ) );

// required password for webservices
$secret_key = 'somekey';
$password = sha1( base64_decode( $secret_key ) . date( 'Ymd' ) );
$user_id = 12345;
echo base64_decode( $secret_key )."<br />";

try {
 
 // calling action with params that were specified in tech doc
 $result = $client->__soapCall(
       'getUser',
       array (
        new SoapParam( $password, 'password' ),
        new SoapParam( $user_id, 'user_id' )
       ) );
     
} catch ( SoapFault $soapFault ) {
 
 // try to find out why we can't get required data
 var_dump( $soapFault );
 echo( '<br />Request: ' . htmlentities( $client->__getLastRequest() ) . '<br />' );
 echo( '<br />Response: ' . htmlentities( $client->__getLastResponse() ) . '<br />' );
}

// echo result from webservice
if ( isset( $result ) ) {
 echo( '

' ); print_r( $result ); echo( '

' );
} else {
 echo 'Can\'t find variable "$result"';
}

?>

Thanks
Avatar of jonathanmelnick
jonathanmelnick

You can't retrieve the wsdl file if it doesn't exist...

Wsdl is used to describe a service, the service cannot describe itself and create the wsdl...
Many popular PHP IDEs (I'm thinking Zend right now ;) have a tool that allows you to quickly create a wsdl description of your php class...
Avatar of mwskuzzy

ASKER

hi jonathanmelnick

I know this and agree with you 100%. But according to pear documentation that since version 0.73 you can generate the wsdl by adding the following param to the uri ?wsdl. I have tried this but it still does not work. The version of pear is 0.91 beta.

Regards
It seems your job is not going to be as simple as adding "?wsdl" to the url, but it seems to work though ! (haven't tested it).

http://www.brainbell.com/tutorials/php/Automatically_Generating_WSDL_With_PEAR_SOAP.htm

I'd be interested in learning from your research and tests... could you post your results ? thx
ASKER CERTIFIED SOLUTION
Avatar of mwskuzzy
mwskuzzy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial