"BSConfigRequest", "BSConfigResponse" => "BSConfigResponse"); // create client in WSDL mode $client = new WSClient(array ("wsdl" =>"wsdl/config_svc.wsdl", "classmap" => $class_map, "to" => GetConfigServiceEndpoint())); // get proxy object reference form client $proxy = $client->getProxy(); $input = new BSConfigRequest(); $input->BS = SERVICE_NAME; $response = $proxy->BSConfigRequest($input); return $response; } /** * This method returns a proxy object so that all the other operations * can use it for calling Web Service operations. * @return a proxy object. */ function GetProxy() { $OPSConfig = GetOPSConfig(); if($OPSConfig) { $class_map = array( "SubmitOrderTransactedQueue" => "SubmitOrderTransactedQueue", "OrderDataBean" => "OrderDataBean", "SubmitOrder" => "SubmitOrder"); if ($OPSConfig->Sec) { //This is the security information $rec_cert = ws_get_key_from_file("./keys/bob_cert.cert"); $pvt_key = ws_get_key_from_file("./keys/alice_key.pem"); $my_cert = ws_get_key_from_file("./keys/alice_cert.cert"); $policy_xml = file_get_contents("policy.xml"); $policy = new WSPolicy($policy_xml); $sec_token = new WSSecurityToken(array("receiverCertificate" => $rec_cert, "privateKey" => $pvt_key, "certificate" => $my_cert)); $client = new WSClient(array ( "wsdl" => "wsdl/TradeOrders.wsdl", "classmap" => $class_map, "policy" => $policy, "securityToken" => $sec_token, "to" => $OPSConfig->OPS)); } else { // create client in WSDL mode $client = new WSClient(array ( "wsdl" => "wsdl/TradeOrders.wsdl", "classmap" => $class_map, "to" => $OPSConfig->OPS)); } // get proxy object reference form client $proxy = $client->getProxy(); } return $proxy; } /** * This method obtains the config service endpoint from a * configuration file. If it can not retrieve from that, it used the * default value. * @return the endpoint. */ function GetConfigServiceEndpoint() { $doc = new DOMDocument(); $result = $doc->load('configuration_service_config.xml'); $service = $doc->getElementsByTagName("config_service")->item(0)->nodeValue; if (!($service)) { $service = "http://localhost:8080/config_service/config_svc.php"; } return $service; } /** * This method does the neccessary processing prior to submit the order * for further processing. * @param order, the order object to be submitted. * @return the order object just submitted. */ function processSubmitOrder($order) { $proxy = GetProxy(); $submitOrder = new SubmitOrder(); $submitOrder->order = new OrderDataBean(); $submitOrder->order->orderID = $order->orderID; $submitOrder->order->orderType = $order->orderType; $submitOrder->order->orderStatus = "open"; $submitOrder->order->quantity = $order->quantity; $submitOrder->order->price = $order->price; $submitOrder->order->orderFee = $order->orderFee; $submitOrder->order->symbol = $order->symbol; if ($proxy) { $proxy->SubmitOrder($submitOrder); } } ?>