public Position OBU1_GetVehiclePosition(string vehID, [FromBody] string address) { if (string.IsNullOrEmpty(address)) { address = "http://127.0.0.1:8080/TRAAS_WS"; //default address } TraasReference.ServiceImplClient client = new TraasReference.ServiceImplClient(); client.Endpoint.Address = new EndpointAddress(address); try { client.Open(); if (isVehicleActive(address, vehID)) { TraasReference.sumoPosition2D vehiclePosition = client.Vehicle_getPosition(vehID); Position position = new Position(); position.X = vehiclePosition.x; position.Y = vehiclePosition.y; return(position); } throw new FaultException("Vehicle with that ID is not in simulation."); } catch (FaultException e) { client.Abort(); throw new FaultException(e.Message); } catch (Exception e) { throw new FaultException(e.InnerException.ToString()); } finally { client.Close(); } }