예제 #1
0
파일: SCATest.php 프로젝트: psagi/sdo
 public function testScaActsAsADataFactory()
 {
     $service = SCA::getService('./SCATestService.php', 'local');
     $person = $service->reply();
     $this->assertTrue($person instanceof SDO_DataObjectImpl);
     $this->assertEquals('personType', $person->getTypename());
 }
예제 #2
0
function display_orders($status)
{
    $warehouse = SCA::getService('../WarehouseService/WarehouseService.php');
    $orders = $warehouse->getOrdersByStatus($status);
    if (count($orders->order) == 0) {
        echo "None\n";
        return;
    }
    include_once "./table.php";
    table_start();
    table_row_start();
    table_cell('<b>Order ID</b>', '#DDDDFF');
    table_cell('<b>Name</b>', '#DDDDFF');
    table_cell('<b>Status</b>', '#DDDDFF');
    table_row_end();
    $odd = false;
    foreach ($orders->order as $order) {
        table_row_start();
        if (!$odd) {
            table_cell("<a href=\"./order_details.php?orderId=" . $order->orderId . "\">" . $order->orderId . "</a>");
            table_cell(isset($order->customer->name) ? $order->customer->name : 'no name supplied');
            table_cell($order->status);
        } else {
            table_cell("<a href=\"./order_details.php?orderId=" . $order->orderId . "\">" . $order->orderId . "</a>", '#DDFFFF');
            table_cell(isset($order->customer->name) ? $order->customer->name : 'no name supplied', '#DDFFFF');
            table_cell($order->status, '#DDFFFF');
        }
        $odd = !$odd;
        table_row_end();
    }
    table_end();
}
예제 #3
0
 /**
  * Handle
  *
  * @param string $calling_component_filename Filename
  * @param string $service_description        Service description
  *
  * @return mixed
  */
 public function handle($calling_component_filename, $service_description)
 {
     SCA::$logger->log("Entering");
     SCA::$logger->log("_handleXmlRpcRequest - {$calling_component_filename}\n");
     try {
         $wsdl_filename = null;
         // create a wrapper, which in turn creates a service
         // instance and fills in all of the references
         $class_name = SCA_Helper::guessClassName($calling_component_filename);
         $instance = SCA::createInstance($class_name);
         $service_proxy = new SCA_Bindings_Xmlrpc_Wrapper($instance, $class_name, $wsdl_filename);
         // create the xmlrpc server that will process the input message
         // and generate the result message
         $xmlrpc_server = new SCA_Bindings_Xmlrpc_Server($service_proxy);
         // handle the current request
         $xmlrpc_server->handle();
     } catch (Exception $ex) {
         // A catch all exception just in case something drastic goes wrong
         // This can often be the case in constructors of the XML infrastructure
         // classes where XMLRPC info can be read over remote connections. We
         // still want to send a sensible error back to the client
         $response = "{\"error\":\"" . $ex->getMessage();
         $response = $response . "\",\"version\":\"1.0\"}";
         // some debugging
         //file_put_contents("xmlrpc_messages.txt",
         //"Response at XMLRPC server = " . $response . "\n",
         //FILE_APPEND);
         header('Content-type: text/xml');
         echo $response;
     }
     return;
 }
예제 #4
0
 /**
  * Place a new order.
  *
  * @param CartType $cart urn::cartNS The ticker symbol.
  * @param CustomerType $customer urn::customerNS The customer data.
  * @return integer The order id.
  */
 public function placeNewOrder($cart, $customer)
 {
     $order = SCA::createDataObject('urn::orderNS', 'OrderType');
     $order->orderId = time();
     $order->status = 'NONE';
     foreach ($cart->item as $item_in_cart) {
         // TODO is a all-in-one copy from one NS to another in the wishlist?
         $item_in_order = $order->createDataObject('item');
         $item_in_order->itemId = $item_in_cart->itemId;
         $item_in_order->description = $item_in_cart->description;
         $item_in_order->price = $item_in_cart->price;
         $item_in_order->quantity = $item_in_cart->quantity;
         $item_in_order->warehouseId = $item_in_cart->warehouseId;
     }
     $order->customer = $customer;
     $payment = $order->customer->payment;
     unset($order->customer->payment);
     // don't send the payment details to the warehouse
     $payment->paymentId = $order->orderId;
     // Send the order to the warehouse for processing
     $this->warehouse->fulfillOrder($order);
     // Log an event to say it's been sent to the warehouse
     $order->status = 'RECEIVED';
     $this->event_log->logEvent($order, "Order awaiting dispatch from warehouse.");
     // Send a payment request to the payment provider
     $this->payment->directPayment($payment);
     // Log an event to say the payment has been requested
     $order->status = 'INVOICED';
     $this->event_log->logEvent($order, "Payment taken.");
     return $order->orderId;
 }
예제 #5
0
파일: ProxyTest.php 프로젝트: psagi/sdo
 public function testSoapProxyActsAsADataFactory()
 {
     $service = SCA::getService('./SoapProxyTest.wsdl');
     $person = $service->createDataObject('PersonNamespace', 'personType');
     $this->assertTrue($person instanceof SDO_DataObjectImpl);
     $this->assertEquals('personType', $person->getTypename());
 }
예제 #6
0
파일: eBayClient2.php 프로젝트: psagi/sdo
function getResults($query)
{
    $ebay_consumer = SCA::getService('eBaySvc.wsdl', 'ebaysoap', array('config' => './config/ebay.ini'));
    // Create the body
    $request = $ebay->createDataObject('urn:ebay:apis:eBLBaseComponents', 'GetSearchResultsRequestType');
    $request->Version = 495;
    $request->Query = 'ipod';
    $request->createDataObject('Pagination');
    $request->Pagination->EntriesPerPage = 10;
    try {
        $results = $ebay->GetSearchResults($request);
        $total_results = $results->PaginationResult->TotalNumberOfEntries;
        echo "<b>{$total_results} results</b><br/><br/>";
        if ($total_results) {
            foreach ($results->SearchResultItemArray as $search_result_items) {
                foreach ($search_result_items as $search_result_item) {
                    echo '<table border="1">';
                    foreach ($search_result_item->Item as $name => $value) {
                        echo "<tr><td>{$name}</td><td>";
                        print_r($value);
                        echo "</td></tr>";
                    }
                    echo '</table></br>';
                }
            }
        }
    } catch (Exception $e) {
        echo '<b>Exception: </b>' . $e->getMessage();
    }
}
예제 #7
0
 /**
  * Create and return a person SDO
  *
  * @return personType personNamespace
  */
 public function reply()
 {
     $person = SCA::createDataObject('PersonNamespace', 'personType');
     $person->name = 'William Shakespeare';
     $person->dob = 'April 1564, most likely 23rd';
     $person->pob = 'Stratford-upon-Avon, Warwickshire';
     return $person;
 }
예제 #8
0
 /**
  * @param string $name
  * @return HelloType http://www.example.org/Hello
  */
 public function hello($name)
 {
     $response = SCA::createDataObject('http://www.example.org/Hello', 'HelloType');
     $response->name = $name;
     $response->greeting = "Hello Fred";
     $response->reversed = "derF olleH";
     return $response;
 }
예제 #9
0
파일: LocalService.php 프로젝트: psagi/sdo
 /**
  * A method that sends an email message
  * 
  * @param EmailType $email http://www.example.org/email
  * @return EmailResponseType http://www.example.org/email
  */
 function sendComplexMessage(SDO_DataObject $email)
 {
     //echo "Sending message $message to address $address";
     $emailresponse = SCA::createDataObject("http://www.example.org/email", "EmailResponseType");
     $emailresponse->address = $email->address;
     $emailresponse->message = $email->message;
     $emailresponse->reply = "local email reply";
     return $emailresponse;
 }
예제 #10
0
 /**
  * generats a greeting for a batch of names.
  *
  * @param string $text custom text
  * @param people $names http://example.org/names
  * @return people http://example.org/names
  */
 function greetEveryone($text, $names)
 {
     $replies = SCA::createDataObject('http://example.org/names', 'people');
     // Iterate through each names to build up the replies
     foreach ($names->name as $name) {
         $replies->name[] = $text . " {$name}";
     }
     return $replies;
 }
예제 #11
0
파일: helloworld.php 프로젝트: psagi/sdo
 /**
  * @param string $name
  * @return HelloType http://www.example.org/Hello
  */
 public function hello($name)
 {
     $greeting = $this->greeting_service->greet($name);
     $reversed_greeting = $this->reversing_service->reverse($greeting->greeting);
     $response = SCA::createDataObject('http://www.example.org/Hello', 'HelloType');
     $response->name = $name;
     $response->greeting = $greeting->greeting;
     $response->reversed = $reversed_greeting;
     return $response;
 }
예제 #12
0
 public function testLocalProxyActsAsADataFactory()
 {
     $service = SCA::getService('./LocalProxyTestSDOReverser.php');
     $person = $service->createDataObject('PersonNamespace', 'personType');
     $person->name = 'William Shakespeare';
     $person->dob = 'April 1564, most likely 23rd';
     $person->pob = 'Stratford-upon-Avon, Warwickshire';
     $this->assertTrue($person instanceof SDO_DataObjectImpl);
     $this->assertEquals('personType', $person->getTypename());
 }
예제 #13
0
파일: Wrapper.php 프로젝트: psagi/sdo
 /**
  * Class constructor
  *
  * @param string $class_name Class name
  * @param string $handler    Handler
  */
 public function __construct($class_name, $handler)
 {
     SCA::$logger->log('Entering');
     SCA::$logger->log("class name = {$class_name}");
     $this->class_name = $class_name;
     $this->xmldas = $handler->getXmlDas();
     $this->instance_of_the_base_class = SCA::createInstance($class_name);
     SCA::fillInReferences($this->instance_of_the_base_class);
     SCA::$logger->log('Exiting');
 }
예제 #14
0
파일: Wrapper.php 프로젝트: psagi/sdo
 public function __construct($class_name, $service_description, $mapper)
 {
     SCA::$logger->log('Entering');
     SCA::$logger->log("class name = {$class_name}");
     $this->mapper = $mapper;
     $this->service_description = $service_description;
     $this->instance_of_the_base_class = SCA::createInstance($class_name);
     SCA::fillInReferences($this->instance_of_the_base_class);
     SCA::$logger->log('Exiting');
 }
예제 #15
0
 /**
  * Create the service wrapper for a SCA Component. In the event that the
  * mapping of the SCA Component methods the base_class and xmldas types are
  * set to null.
  *
  * @param string $class_name Class name
  */
 public function __construct($class_name)
 {
     SCA::$logger->log("Entering constructor");
     SCA::$logger->log("class_name = {$class_name}");
     $this->class_name = $class_name;
     $this->instance_of_the_base_class = SCA::createInstance($class_name);
     SCA::fillInReferences($this->instance_of_the_base_class);
     //need an xmldas
     //want to have the xsds in here. do xmldas only here then do add types.
     $this->xml_das = self::getXmldasForAtom($class_name, "");
     SCA::$logger->log("Exiting Constructor");
 }
예제 #16
0
파일: Bug12193Test.php 프로젝트: psagi/sdo
 public function testCanCreateOperationSdoRegardlessOfAlphabeticOrder()
 {
     $service = SCA::getService('./HelloPersonService.wsdl');
     $person = $service->createDataObject('aaa://PersonNamespace', 'personType');
     $person->name = 'William Shakespeare';
     $arguments = array($person);
     $method_name = 'hello';
     //  before the fix to 12193, the following call threw
     // SDO_UnsupportedOperationException: createDocument - cannot find element hello
     $operation_sdo = $service->getSoapOperationSdo($method_name, $arguments);
     $this->assertEquals('http://HelloPersonService', $operation_sdo->getTypeNamespaceURI());
 }
예제 #17
0
파일: ContactFeed.php 프로젝트: psagi/sdo
 /**
  * Converts an Atom Entry SDO to a Contact SDO.
  */
 private function entryToContact($entry)
 {
     $contact = SCA::createDataObject('http://example.org/contacts', 'contact');
     // Set the title (this is assumed to be the first piece of unstructured text)
     // We are considering ways to make this simpler in SDO.
     // Something like $seq->values[0], maybe.
     // Also, note how title and author, etc are many-valued.  This is due
     // to limitations in xml schema's ability to model the Atom XML.
     // We are working on ways to improve the SDO APIs in these
     // circumstances.  One way would be a shortcut to the first entry, so
     // $entry->title[0]->getSequence() and $entry->title->getSequence()
     // would be equivalent.
     $seq = $entry->title[0]->getSequence();
     for ($i = 0; $i < count($seq); $i++) {
         if ($seq->getProperty($i) == null) {
             $contact->title = $seq[$i];
         }
     }
     // The last part of the entry id (in uri form) is the contact id
     $segments = explode('/', $entry->id[0]->value);
     $contact->id = $segments[count($segments) - 1];
     // Set the author and updated properties
     $contact->author = $entry->author[0]->name[0];
     $contact->updated = $entry->updated[0]->value;
     /*****************************************************/
     /* Should be able to use XPath but encountered a bug */
     /* which mean xpath only searches down 1 level on    */
     /* open types  (e.g. $div['ul/li[title="email"]'];)   */
     /*****************************************************/
     // Get the div and then loop through the <li/>s inside the <ul/>.  The
     // contents of each is the first peice of unstructured text.  This code
     // assumes the span title attribute matches the contact property name.
     $div = $entry->content[0]->div;
     /**************** The xhtml should be of this form *************************/
     /* <ul class="xoxo contact" title="contact" >                              */
     /*   <li class="shortname" title="shortname">shifty</li>                   */
     /*   <li class="fullname" title="fullname">Rt. Hon. Elias Shifty Esq.</li> */
     /*   <li class="email" title="email">shifty@uk.ibm.com</li>                */
     /* </ul>                                                                   */
     /***************************************************************************/
     $ul = $div[0]->ul;
     $lis = $ul[0]['li'];
     foreach ($lis as $li) {
         $seq = $li->getSequence();
         for ($i = 0; $i < count($seq); $i++) {
             if ($seq->getProperty($i) == null) {
                 $contact->{$li->class} = $seq[$i];
             }
         }
     }
     return $contact;
 }
예제 #18
0
파일: Wrapper.php 프로젝트: psagi/sdo
 /**
  * Create the service wrapper for an SCA Component. In the event that the
  * mapping of the SCA Component methods the base_class and xmldas types are
  * set to null.
  *
  * @param string $class_name Class name
  */
 public function __construct($class_name)
 {
     //TODO: get rid of the wsdl filename here
     SCA::$logger->log("Entering constructor");
     SCA::$logger->log("class_name = {$class_name}");
     $this->class_name = $class_name;
     $this->class_instance = SCA::createInstance($class_name);
     SCA::fillInReferences($this->class_instance);
     //need an xmldas
     //want to have the xsds in here. do xmldas only here then do add types.
     $this->xml_das = SCA_Helper::getXmldas($class_name, "");
     SCA::$logger->log("Exiting Constructor");
 }
예제 #19
0
 /**
  * Generate
  *
  * @param string $service_description Service Description
  *
  * @return null
  */
 public function generate($service_description)
 {
     SCA::$logger->log("Entering");
     try {
         $smd_str = SCA_GenerateSmd::generateSmd($service_description);
         SCA::sendHttpHeader('Content-type: text/plain');
         echo $smd_str;
     } catch (SCA_RuntimeException $se) {
         echo $se->exceptionString() . "\n";
     } catch (SDO_DAS_XML_FileException $e) {
         throw new SCA_RuntimeException("{$e->getMessage()} in {$e->getFile()}");
     }
     return;
 }
예제 #20
0
 public function retrieveOrdersByStatus($status)
 {
     $files = $this->_order_files();
     $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/../Schema/Order.xsd');
     $orders = SCA::createDataObject('urn::orderNS', 'OrdersType');
     foreach ($files as $file) {
         $xdoc = $xmldas->loadFile(dirname(__FILE__) . '/Orders/' . $file);
         $order = $xdoc->getRootDataObject();
         if ($order->status == $status) {
             $orders->order[] = $order;
         }
     }
     return $orders;
 }
예제 #21
0
파일: Wrapper.php 프로젝트: psagi/sdo
 /**
  * Create the service wrapper for an SCA Component. In the event that the
  * mapping of the SCA Component methods the base_class and xmldas types are
  * set to null.
  *
  * @param string $class_name Class name
  */
 public function __construct($class_name)
 {
     //TODO: get rid of the wsdl filename here
     SCA::$logger->log("Entering constructor");
     SCA::$logger->log("class_name = {$class_name}");
     $this->class_name = $class_name;
     $this->class_instance = SCA::createInstance($class_name);
     SCA::fillInReferences($this->class_instance);
     // Get an xmldas to handle the SDOs passing in and
     // out of the wrapped service. This call creates the das
     // and adds all of the service types to it.
     $this->xml_das = SCA_Helper::getXmldas($class_name, "");
     SCA::$logger->log("Exiting Constructor");
 }
예제 #22
0
파일: BatchService.php 프로젝트: psagi/sdo
 /**
  * Say "Hello" to a batch of names.
  * Note: this demonstrates how to declare data structures in
  * the @param and @return annotations.
  *
  * @param people $names http://example.org/names
  * @return people http://example.org/names
  */
 function sayHello($names)
 {
     /*********************************************************************/
     /* Creating an SDO for the replies.  This is not strictly necessary  */
     /* but is done to demonstate how a service gets an SDO for a type it */
     /* declares in the @types annotation.                                */
     /*********************************************************************/
     $replies = SCA::createDataObject('http://example.org/names', 'people');
     // Iterate through each names to build up the replies
     foreach ($names->name as $name) {
         $replies->name[] = "Hello {$name}";
     }
     return $replies;
 }
예제 #23
0
 /**
  * make it look to the component as if it is receiving  
  * a GET request for a URL with a resourceId
  */
 public function testRetrieve()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['SCRIPT_FILENAME'] = 'Orders.php';
     $_SERVER['REQUEST_URI'] = 'http://localhost/Orders.php/order1';
     $_SERVER['CONTENT_TYPE'] = 'test/plain';
     $_SERVER['PATH_INFO'] = '/order1';
     ob_start();
     SCA::initComponent("Orders.php");
     $out = ob_get_contents();
     ob_end_clean();
     $string1 = str_replace("\r", "", $out);
     $string2 = str_replace("\r", "", $this->retrieve_response);
     $this->assertEquals($string1, $string2);
 }
예제 #24
0
파일: TestService.php 프로젝트: psagi/sdo
 /**
  * A method that provides a complex interface and uses a complex interface
  * 
  * @param EmailType $email http://www.example.org/email
  * @return EmailResponseListType http://www.example.org/email
  */
 function test(SDO_DataObject $email)
 {
     $json_response = $this->email_service->sendComplexMessage($email);
     $email_response_list = SCA::createDataObject("http://www.example.org/email", "EmailResponseListType");
     $email_response = SCA::createDataObject("http://www.example.org/email", "EmailResponseType");
     $email_response->address = "Address 1";
     $email_response->message = "Message 1";
     $email_response->reply = "Reply 1";
     $email_response_list->jsonemail[] = $email_response;
     $email_response = SCA::createDataObject("http://www.example.org/email", "EmailResponseType");
     $email_response->address = "Address 2";
     $email_response->message = "Message 2";
     $email_response->reply = "Reply 2";
     $email_response_list->jsonemail[] = $email_response;
     return $email_response_list;
 }
예제 #25
0
파일: RestRpcTest.php 프로젝트: psagi/sdo
 /**
  * make it look to the component as if it is receiving  
  * a GET request for a method invocation and check the response 
  * is correct
  */
 public function testGETForm()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['SCRIPT_FILENAME'] = 'RestRpcTestService.php';
     $_SERVER['REQUEST_URI'] = 'http://localhost/TestService.php?name=Bill';
     $_SERVER['PATH_INFO'] = ' hello';
     $_SERVER['CONTENT_TYPE'] = 'application/test';
     $_GET = array("name", "Bill");
     ob_start();
     SCA::initComponent("RestRpcTestService.php");
     $out = ob_get_contents();
     ob_end_clean();
     $string1 = str_replace("\r", "", $out);
     $string2 = str_replace("\r", "", $this->response);
     $this->assertEquals($string1, $string2);
 }
예제 #26
0
 /**
  * Handle
  *
  * @param string $calling_component_filename Filename
  * @param string $service_description        Service description
  *
  * @return mixed
  */
 public function handle($calling_component_filename, $service_description)
 {
     SCA::$logger->log("Entering");
     try {
         $smd_filename = str_replace('.php', '.smd', $calling_component_filename);
         if (!file_exists($smd_filename)) {
             file_put_contents($smd_filename, SCA_GenerateSmd::generateSmd($service_description));
             //                    ,self::generateSMD($calling_component_filename)
             //                   );
         }
         $wsdl_filename = null;
         // create a wrapper, which in turn creates a service
         // instance and fills in all of the references
         $class_name = SCA_Helper::guessClassName($calling_component_filename);
         $instance = SCA::createInstance($class_name);
         $service_wrapper = new SCA_ServiceWrapperJson($instance, $class_name, $wsdl_filename);
         // create the jsonrpc server that will process the input message
         // and generate the result message
         $jsonrpc_server = new SCA_JsonRpcServer($service_wrapper);
         $jsonrpc_server->handle();
     } catch (Exception $ex) {
         // A catch all exception just in case something drastic goes wrong
         // This can often be the case in constructors of the JSON infsatructure
         // classes where SMD files can be read over remote connections. We
         // still want to send a sensible error back to the client
         // TODO extend the JSON service to expose this kind of function
         //      through public methods
         $response = "{\"id\":\"";
         $response = $response . SCA_JsonRpcServer::getRequest()->id;
         $response = $response . "\",\"error\":\"" . $ex->getMessage();
         $response = $response . "\",\"version\":\"1.0\"}";
         // TODO what to do about id? We can catch errors before the
         //      input is parsed
         // some debugging
         //                file_put_contents("json_messages.txt",
         //                "Response at JSONRPC server = " . $response . "\n",
         //                FILE_APPEND);
         header('Content-type: application/json-rpc');
         echo $response;
     }
     return;
 }
예제 #27
0
 /**
  * Create the service wrapper for a SCA Component. In the event that the mapping
  * of the SCA Component methods the base_class and xmldas types are set to
  * null.
  *
  * @param string $class_name
  * @param string $wsdl_filename
  */
 public function __construct($instance, $class_name, $wsdl_filename)
 {
     SCA::$logger->log("Entering");
     $this->class_name = $class_name;
     $this->instance_of_the_base_class = $instance;
     SCA::fillInReferences($this->instance_of_the_base_class);
     // create a JSON DAS and populate it with the valid types
     // that this service can create. Not strinctly required
     // for json encoding but the JSON Server uses this
     // DAS for decoding
     $xsds = SCA_Helper::getAllXsds($class_name);
     $this->json_das = new SDO_DAS_Json();
     foreach ($xsds as $index => $xsds) {
         list($namespace, $xsdfile) = $xsds;
         if (SCA_Helper::isARelativePath($xsdfile)) {
             $xsd = SCA_Helper::constructAbsolutePath($xsdfile, $class_name);
             $this->json_das->addTypesXsdFile($xsd);
         }
     }
 }
예제 #28
0
 /**
  * Retrieve contact details
  *
  * @param string $shortname The short name of the contact
  * @return contact http://example.org/contacts The full contact details
  */
 public function retrieve($shortname)
 {
     try {
         SCA::$logger->log("Retrieve details for shortname {$shortname}");
         $dbh = new PDO(PDO_DSN, DATABASE_USER, DATABASE_PASSWORD);
         $stmt = $dbh->prepare('SELECT * FROM contact WHERE shortname = ?');
         $stmt->execute(array($shortname));
         $row = $stmt->fetch();
         $contact = SCA::createDataObject('http://example.org/contacts', 'contact');
         $contact->shortname = $shortname;
         if ($row) {
             SCA::$logger->log("Contact found {$shortname} = " . $row['FULLNAME'] . " " . $row['EMAIL']);
             //trigger_error("Contact found: " . $shortname);
             $contact->fullname = $row['FULLNAME'];
             $contact->email = $row['EMAIL'];
         }
         $dbh = 0;
         return $contact;
     } catch (Exception $ex) {
         SCA::$logger->log("Exception on database read = " . $ex);
     }
 }
예제 #29
0
파일: Wrapper.php 프로젝트: psagi/sdo
 /**
  * Create the service wrapper for a SCA Component.
  *
  * @param object $instance      Instance
  * @param string $class_name    Class
  * @param string $wsdl_filename WSDL
  */
 public function __construct($instance, $class_name, $wsdl_filename)
 {
     SCA::$logger->log("Wrapper {$class_name}");
     $this->class_name = $class_name;
     $this->instance_of_the_base_class = $instance;
     SCA::fillInReferences($this->instance_of_the_base_class);
     $this->annotations = new SCA_AnnotationReader($this->instance_of_the_base_class);
     // create an XML-RPC DAS and populate it with the valid types
     // that this service can create.
     $xsds = SCA_Helper::getAllXsds($class_name);
     $this->xmlrpc_das = new SCA_Bindings_Xmlrpc_DAS();
     foreach ($xsds as $index => $xsds) {
         list($namespace, $xsdfile) = $xsds;
         if (SCA_Helper::isARelativePath($xsdfile)) {
             $xsd = SCA_Helper::constructAbsolutePath($xsdfile, $class_name);
             $this->xmlrpc_das->addTypesXsdFile($xsd);
         }
     }
     $this->xmlrpc_server = xmlrpc_server_create();
     $service_description = $this->annotations->reflectService();
     $serviceDescGen = new SCA_Bindings_Xmlrpc_ServiceDescriptionGenerator();
     $serviceDescGen->addIntrospectionData($this->xmlrpc_server, $service_description, $this->method_aliases, $this->xmlrpc_das);
 }
예제 #30
0
파일: eBayClient.php 프로젝트: psagi/sdo
function getResults($query)
{
    $ebay_consumer = SCA::getService('eBayConsumer.php');
    try {
        $results = $ebay_consumer->GetSearchResults($query);
        $total_results = $results->PaginationResult->TotalNumberOfEntries;
        echo "<b>{$total_results} results</b><br/><br/>";
        if ($total_results) {
            foreach ($results->SearchResultItemArray as $search_result_items) {
                foreach ($search_result_items as $search_result_item) {
                    echo '<table border="1">';
                    foreach ($search_result_item->Item as $name => $value) {
                        echo "<tr><td>{$name}</td><td>";
                        print_r($value);
                        echo "</td></tr>";
                    }
                    echo '</table></br>';
                }
            }
        }
    } catch (Exception $e) {
        echo '<b>Exception: </b>' . $e->getMessage();
    }
}