Code:
<?php
/*
* Created on Oct 19, 2009
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Ws_client extends Controller
{
function __construct()
{
session_start();
parent::Controller();
}
public function client_send_data()
{
try{
ini_set( 'soap.wsdl_cache_ttl' , 0 );
$client = new SoapClient("http://localhost/Hello.wsdl",
array('soap_version' => SOAP_1_2,'trace' => 1 ));
echo("\nDumping client object functions:\n");
var_dump($client->__getFunctions());
$return = $client->__soapCall("hello",array("world"));
echo("\nReturning value of __soapCall() call: ".$return);
$return = $client->hello("World");
echo("\nReturning value: ".$return);
echo("\nDumping request headers:\n"
.$client->__getLastRequestHeaders());
echo("\nDumping request:\n".$client->__getLastRequest());
echo("\nDumping response headers:\n"
.$client->__getLastResponseHeaders());
echo("\nDumping response:\n".$client->__getLastResponse());
}
catch (SoapFault $exception)
{
echo $exception;
}
}
}
?>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="MyDefinition"
targetNamespace="urn:myTargetNamespace"
xmlns:tns="urn:myTns"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<message name="myRequest">
<part name="reqParam" type="xsd:string"/>
</message>
<message name="myResponse">
<part name="resParam" type="xsd:string"/>
</message>
<portType name="MyPortType">
<operation name="hello">
<input message="tns:myRequest"/>
<output message="tns:myResponse"/>
</operation>
</portType>
<binding name="MyBinding" type="tns:MyPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded"
namespace="urn:myInputNamespace"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="urn:myOutputNamespace"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="MyService">
<documentation>Returns a greeting string.
</documentation>
<port name="MyPort" binding="tns:MyBinding">
<soap:address
location="http://localhost/ws_server/my_server/"/>
</port>
</service>
</definitions>