Click here to Skip to main content
12,949,083 members (62,058 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Top Experts
Last 24hrsThis month
OriginalGriff 5,489
CHill60 3,330
Maciej Los 2,913
Jochen Arndt 1,935
ppolymorphe 1,820


Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 10 Mar 2010
Copyright © CodeProject, 1999-2017
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