Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP
Is there any class of methor in PHP to generate WSDL file???
Posted 8-Mar-10 17:50pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The first hit on Google when searching for "wsdl class php[^]" seems to be what you are after.
 
http://www.phpclasses.org/browse/package/3509.html[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I m trying to create a helloworld
Web service using that class, i have created WSDL file ...
But Unable to call it from client End
 
HelloWorldClass.php
 
<?php
    class HelloWorldClass
    {
        /**
         * Get the example
         *
         * @return string
         */
        public function printHello()
        {
            return 'Hello User';
        }
        /**
         * Adds two numbers
         *
         * @param float $p1
         * @param float $p2
         * @return float
         */
        public function add($p1, $p2) {
            return ($p1+$p2);
        }
    }
?>
 
index.php to create WSDL using wsdlCreater Class
 
<?php
require_once('WSDLCreator.php');

$WSDLCreator = new WSDLCreator("myTestWsdl", "http://192.168.1.49/php2wsdl");
$WSDLCreator -> addFile("HelloWorldClass.php");
$WSDLCreator -> addURLToClass('HelloWorldClass',"http://192.168.1.49/php2wsdl/HelloWorldClass.php");
$WSDLCreator -> addURLToTypens("XMLCreator", "http://192.168.1.49/php2wsdl");
$WSDLCreator -> createWSDL();
$WSDLCreator -> printWSDL(true);
?>
 

SoapClient.PHP
 
<?php
    try
    {
        $client =   new SoapClient("http://192.168.1.49/php2wsdl/");
        echo "<pre>";
        echo $client    ->__soapCall('printHello',array());
    }
    catch (Exception $e)
    {
        echo $e->getMessage()."<br><pre>";
    }
?>
 
GENERATED WSDL FILE:--
 
<definitions name="myTestWsdl" targetNamespace="urn:myTestWsdl"><message name="add">
<part name="p1" type="xsd:float"/>
<part name="p2" type="xsd:float"/>
</message><message name="addResponse">
<part name="addReturn" type="xsd:float"/>
</message>
<message name="printHello"/><message name="printHelloResponse">
<part name="printHelloReturn" type="xsd:string"/>
</message><portType name="HelloWorldClassPortType"><operation name="add">
<documentation>Adds two numbers</documentation>
<input message="typens:add"/>
<output message="typens:addResponse"/>
</operation><operation name="printHello">
<documentation>Get the example</documentation>
<input message="typens:printHello"/>
<output message="typens:printHelloResponse"/>
</operation>
</portType><binding name="HelloWorldClassBinding" type="typens:HelloWorldClassPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="add">
<soap:operation soapAction="urn:HelloWorldClassAction"/><input>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input><output>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation><operation name="printHello">
<soap:operation soapAction="urn:HelloWorldClassAction"/><input>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input><output>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding><service name="myTestWsdlService"><port name="HelloWorldClassPort" binding="typens:HelloWorldClassBinding">
<soap:address location="http://192.168.1.49/php2wsdl/HelloWorldClass.php"/>
</port>
</service>
</definitions>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 540
1 Sergey Alexandrovich Kryukov 432
2 Yogesh Kumar Tyagi 384
3 Prakriti Goyal 280
4 Maciej Los 205
0 OriginalGriff 6,632
1 Sergey Alexandrovich Kryukov 5,404
2 Maciej Los 3,474
3 Peter Leow 3,299
4 DamithSL 2,495


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 10 Mar 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100