2008年9月8日星期一

[fw-core] Exchange web services and Zend_Soap_Client

Has anyone gotten Zend_Soap_Client to work with MS Exchange web services?

I have been using references from
http://tp.its.yale.edu/confluence/display/EXCH/Introduction+to+MS+Exchange+Web+Services+via+Java(JAXWS)
and http://msdn.microsoft.com/en-us/library/bb204119.aspx for
information, but I am clearly missing some key pieces.

I have downloaded the WSDL files to my local box. I then added the
service definistion as suggested in the former URL as:

<wsdl:service name="ExchangeServices">
<wsdl:port name="ExchangeServicePort" binding="tns:ExchangeServiceBinding">
<soap:address
location="https://owacasserver.mydomain.com/EWS/Exchange.asmx" />
</wsdl:port>
</wsdl:service>

The exact error I get is:

Fatal error: Uncaught SoapFault exception: [HTTP] Unauthorized in
/web/applications/modules/home/controllers/IndexController.php:18
Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml
version="...', 'https://owa.gpc...', 'http://schemas....', 1, 0) #1
[internal function]: SoapClient->__call('FindItem', Array) #2
/web/applications/modules/home/controllers/IndexController.php(18):
SoapClient->FindItem(10) #3
/web/library/Zend/Controller/Action.php(502):
IndexController->indexAction() #4
/web/library/Zend/Controller/Dispatcher/Standard.php(293):
Zend_Controller_Action->dispatch('indexAction') #5
/web/library/Zend/Controller/Front.php(946):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #6 /web/htdocs/index.php5(62):
Zend_Controller_Front->dispatch() #7 {main in
/web/applications/modules/home/controllers/IndexController.php on line
18

My code is as follows:

<?php

require_once('Zend/Loader.php');
Zend_Loader::LoadClass('Zend_Soap_Client');

class IndexController extends Zend_Controller_Action
{

public function indexAction()
{
$this->view->headTitle('Home');
$soapclient = new
SoapClient("/web/applications/modules/home/controllers/Services.wsdl",
array('compression' => SOAP_COMPRESSION_ACCEPT,
'login'=>'myusername','password'=>'mypassword'));
$result = $soapclient->FindItem();
print_r($result);

}

}

?>

I am passing my user name and password, so it doesn't make any sense
to get an unauthorized error. Does anyone have any ideas? Thanks in
advance.

--
Andrew Sledge

没有评论: