Re: I need Examples off complex types use

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

 



Here is a sample i built.
It is derived from an xmethods sample. There, you can find lots of wsdl
samples ...

1 the wsdl
----------------------------------------------------------------------------
------------------
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="IBank" targetNamespace=" ...>
        <types>
                <schema targetNamespace="http://www.xmethods.net/ws-demo/";
                    xmlns:tns="http://www.xmethods.net/ws-demo/";
                    xmlns="http://www.w3.org/2001/XMLSchema";
                    xmlns:xs="http://www.w3.org/2001/XMLSchema";
                    elementFormDefault="qualified">
                        <xs:element name="chargeRequest">
                                <xs:complexType>
                                        <xs:sequence>
                                                <xs:element
name="customerID" type="xs:string"/>
                                                <xs:element name="amount"
type="xs:float"/>
                                        </xs:sequence>
                                </xs:complexType>
                        </xs:element>
                        <xs:element name="chargeResponse">
                                <xs:complexType>
                                        <xs:sequence>
                                                <xs:element name="Result"
type="xs:string"/>
                                        </xs:sequence>
                                </xs:complexType>
                        </xs:element>
                </schema>
        </types>
        <message name="charge0SoapIn">
                <part name="chargeRequest" element="tns:chargeRequest"/>
        </message>
        <message name="charge0SoapOut">
                <part name="chargeResponse" element="tns:chargeResponse"/>
        </message>
       <portType name="IBankSoap">
                <operation name="charge">
                        <input name="charge0SoapIn"
message="tns:charge0SoapIn"/>
                        <output name="charge0SoapOut"
message="tns:charge0SoapOut"/>
                </operation>
        </portType>

        <binding name="IBankSoap" type="tns:IBankSoap">
                <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="charge">
                        <soap:operation soapAction="" style="document"/>
                        <input name="charge0SoapIn">
                                <soap:body use="literal"/>
                        </input>
                        <output name="charge0SoapOut">
                                <soap:body use="literal"/>
                        </output>
                </operation>
        </binding>

        <service name='ChargeService'>
  <port name='ChargePort' binding='IBankSoap'>
    <soap:address location='http://localhost/server.php'/>
  </port>

        </service>
</definitions>

2 The Client (Both three calls should work with php5
----------------------------------------------------------------------------
------------------
              $client = new SoapClient("something.wsdl", Array('trace'=>1));
                $param = Array("customerID"=>"12345", "amount"=>406);
                $return = $client->charge($param);
                $po = (object)$param;
                $return = $client->charge($po);
                $po2 = new ChargeRequest("12345", 407);
                $return = $client->charge($po2);

3 The server in charge method $param is an object with amount and customerID
attributes
----------------------------------------------------------------------------
------------------
class Bank{
    function charge($param) {
          ..
          return $valret;
    }
}

$server = new SoapServer("something.wsdl");
$server->setClass(Bank);
$server->handle();

Hope it helps

--

"Wasenbr" <wasenbr@yahoo.com.br> wrote in message
20041109180551.21497.qmail@pb1.pair.com">news:20041109180551.21497.qmail@pb1.pair.com...
> Hello!
>
> Where I find examples for complex types use in PHP5 SOAP extension?
>
> Wasenbr

-- 
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