[prev in list] [next in list] [prev in thread] [next in thread]
List: php-soap
Subject: [SOAP] if soapaction is a namespace how call my method?
From: cblunet <paolocerto () gmail ! com>
Date: 2008-05-16 10:16:19
Message-ID: 17271519.post () talk ! nabble ! com
[Download RAW message or body]
Hi,
I have a simple soap client and server.
All run fine with my wsdl file, but I must use another wsdl
and don't run
this wsdl use a namespace in soapaction parameter and I don't know how call
my_method.
Someone can help me?
Thanks
client.php
------------------------------------------
ini_set('soap.wsdl_cache_enabled', '0');
try{
$client = new SoapClient(null, array(
'location' => "url_to_server",
'uri' => "namespace_from_wsdl",
'trace' => 1,
'exceptions' =>0));
$return = $client->__soapCall('my_method', array(),
array(
'soapaction' => 'my_method',
'uri' => 'namespace_from_wsdl'));
echo $return;
}catch (SoapFault $e){
echo $e->getMessage();
}
---------------------------------------------
server.php
---------------------------------------------
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer('url_to_wsdl_file');
$server->setClass('my_class');
$server->handle();
---------------------------------------------
my_class.php
---------------------------------------------
class my_class {
function my_method() {
$xml = '<?xml version="1.0" encoding="utf-8"?>
<products><list><item key="name"
value="some_value" /></list></products>';
return $xml;
}
}
header("Content-type: text/xml");
require_once 'server.php';
exit;
---------------------------------------
wsdl file
---------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="namespace"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="namespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="namespace"
xmlns:xxx="http://www.xxx.org/schemas/WSData">
<s:import schemaLocation="dati.xsd"
namespace="http://www.xxx.org/schemas/WSData"/>
<s:element name="my_method">
<s:complexType />
</s:element>
<s:element name="my_methodResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="my_methodResult"
type="xxx:ResponseData" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="my_methodSoapIn">
<wsdl:part name="parameters" element="tns:my_method" />
</wsdl:message>
<wsdl:message name="my_methodSoapOut">
<wsdl:part name="parameters" element="tns:my_methodResponse" />
</wsdl:message>
<wsdl:portType name="my_classSoap">
<wsdl:operation name="my_method">
<wsdl:input message="tns:my_methodSoapIn" />
<wsdl:output message="tns:my_methodSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="my_classSoap" type="tns:my_classSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="my_method">
<soap:operation soapAction="namespace/my_method" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="my_class">
<wsdl:port name="my_classSoap" binding="tns:my_classSoap">
<soap:address location="http://xxx.org/services/my_class.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
--
View this message in context: \
http://www.nabble.com/if-soapaction-is-a-namespace-how-call-my-method--tp17271519p17271519.html
Sent from the Php - Soap mailing list archive at Nabble.com.
--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic