开发者

php SoapServer not print any xml document

all

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.


The XML document not found error usually occurs when there is an empty space before php opening or after closing tag, try clearing that and test.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜