I create a soap server use below code. I found it is a little hard to create wsdl document in PHP .so I decide use non-wsdl mode.
$soapServer = new SoapServer(NULL,array('uri'=>'http://com.test.env',
'encoding'=>'UTF-8'));
$soapServer->addFunction("workprocess_orders_api_add");
$soapServer->addFunction("workprocess_list_api_get_local_name");
$soapServer->handle();
but when I try to access this program, it print nothing. both web-browser and program(I use SoapClient)
$client = new SoapClient(NULL,array('uri'=>'http://com.test.env',
'location'=>'http://localhost/~breeze.kay/ams/workprocess/api/soap/',
'trace'=>1,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL));
var_dump($client->__call('workprocess_orders_api_add',array())); //print null
var_dump($client->__getFunctions()); //print null
I tired call some function like this at client-side:
echo $client->sayHello('test');
I get error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in /Users/breeze.kay/Sites/ad-test/soap.php:15
where is wrong ? I have no idea.:( the code looks ok. why there is no print?
OK, I tried it out.
the problem is the request url must append ?wsdl ,like this: http://localhost/wbs/api.php?wsdl
but I use url-rewrite for my sites. the rewrite rule break the original url struct.
by the way, dose somebody know where talk about the url rule for soap request?
I read some manual not find it.
0 comments:
Post a Comment